This script allows you to run any command remotely using Powershell on your network. I usually use this to update group policy configurations on all PCs on my network remotely.
Note: In Windows Server 2012 & Windows Server 2012 R2, you can run the Invoke-GPUpdate
PowerShell cmdlet ro refresh group policy on any Windows 8 computers on your network. More information here.
PsExec.exe \\* -s cmd /C echo N | gpupdate /force
gpupdate /force
on all workstationsWhen you run it, you’ll see some output like:
Starting cmd on PC1-USRNAME... on PC1-USRNAME...
cmd exited on PC1-USRNAME with error code 0.
“error code 0
” means it has completed successfully without any errors.
PC1-USRNAME
,
replace "\\*
" with "\\PC1-USRNAME
" as shown below:
PsExec.exe \\PC1-USRNAME -s cmd /C echo N | gpupdate /force
PsExec.exe \\* -s cmd /C echo Y | gpupdate /force
PsExec.exe \\* -s cmd /C
PsExec.exe \\* -s cmd /C mkdir C:\test
(header image source: interfaceit.com)