Run Registry File Remotely with PowerShell -


i'm using following script run test.reg on multiple remote systems:

$computers = get-content computers.txt  invoke-command -computername $computers -scriptblock {   regedit /i /s "\\server\c$\registryfiles\test.reg" } 

the script doesn't error, registry entry doesn't import on of systems.

i know test.reg file valid registry file because copied over, ran manually, , registry key imports. made sure powershell remoting enabled on remote computers.

any ideas why registry key isn't importing?

i found best way not mess issues related server authentication , cut down on complexity pass reg file parameter function.

$regfile = @"  windows registry editor version 5.00  [hkey_local_machine\system\currentcontrolset\services\tcpip\parameters] "maxuserport"=dword:00005000 "tcptimedwaitdelay"=dword:0000001e "@  invoke-command -computername computername -scriptblock {param($regfile) $regfile | out-file $env:temp\a.reg;      reg.exe import $env:temp\a.reg } -argumentlist $regfile 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -