Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Apply Registry File to Remote Systems

$
0
0

I'm trying to apply a registry file to remote systems defined in a list.  I tried the following from this thread:

 

$targetservers = Get-Content servers.txt

$HostedRegFile = "C:\Scripts\RegistryFiles\test.reg"

$newfile = "\\$server\c$\Downloads\RegistryFiles\test.reg"

 

foreach ($server in $servers)

{

Copy-Item $HostedRegFile -Destination $newfile

Invoke-Command -ComputerName $server -ScriptBlock {

Start-Process -filepath "C:\windows\regedit.exe" -argumentlist "/s $newfile"

    }

}

 

I get the following error:



I made some edits and got the .reg file to copy over, but it still didn't execute on the remote machines and add content to the registry.

Any ideas how to get it to actually apply?

Thanks for the help.


Viewing all articles
Browse latest Browse all 6937

Trending Articles