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:ScriptsRegistryFilestest.reg"
$newfile = "\$serverc$DownloadsRegistryFilestest.reg"
foreach ($server in $servers)
{
Copy-Item $HostedRegFile -Destination $newfile
Invoke-Command -ComputerName $server -ScriptBlock {
Start-Process -filepath "C:windowsregedit.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.