0

So i know I can't use Netsh because WinRM is disabled/access denied on my network. I cant invoke etc. So I'm trying to figure out a way to take a list of computer names and get the proxy from the machines. So, my idea is to take the list I have on a \share, and foreach ($pc in $list) I would copy over a .cmd file from the same share. that .cmd file just runs a powershell script from the share, on that remote machine. So copy a cmd to remote machine. Run cmd on remote machine, that cmd just runs the powershell script that gets the proxy from the registry, and then writes the machine name and the proxy to a file on the share. But, I'm getting a blank output tho. So, weird. Here's the script that runs on the remote machine:

Set-ExecutionPolicy Unrestricted -Force

$proxy = (Get-ItemProperty

'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings') | Select-Object AutoConfigURL

"$env:computername $proxy" | Out-file -filepath "\share\Proxy\IEproxylistResolved.csv"

The problem is that I get empty file in IEproxylistResolved.csv its 3am and I'm prob just half dead in the head but could use a fresh perspective.

Alnizzo
  • 1
  • 1
  • 1
  • ok... so how do You want to trigger that script on remote machine? Would PsExec work in Your environment ? – Tomek Sep 20 '18 at 10:49

1 Answers1

0

Have you tried this:

Import-Module PSRemoteRegistry
Get-RegValue -ComputerName $Computer1 -Key 
"Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Value AutoConfigURL

Source

Akaino
  • 1,025
  • 6
  • 23