run a reg file remotely
Posted: Fri Sep 22, 2017 2:00 am
I want to run a .reg file remotely for changing its register
The code is
$nomservidor="ssvspospocpa2"
$pathserver="c:\temp\snmp.reg"
Invoke-Command -ComputerName $nomservidor -ScriptBlock {
Start-Process -FilePath "c:\windows\regedit.exe" -ArgumentList "/s $pathserver"
} -Credential pospocpa\administrator
It doesn't work although there is no error.
If I run
Start-Process -FilePath "c:\windows\regedit.exe" -ArgumentList "/s $pathserver"
directly in the server it Works ok so I don't Know where is the problem
Thanks
The code is
$nomservidor="ssvspospocpa2"
$pathserver="c:\temp\snmp.reg"
Invoke-Command -ComputerName $nomservidor -ScriptBlock {
Start-Process -FilePath "c:\windows\regedit.exe" -ArgumentList "/s $pathserver"
} -Credential pospocpa\administrator
It doesn't work although there is no error.
If I run
Start-Process -FilePath "c:\windows\regedit.exe" -ArgumentList "/s $pathserver"
directly in the server it Works ok so I don't Know where is the problem
Thanks