search
Categories
Archive
Blogroll

Badges

Microsoft PowerShell MVP
MCSE
Sponsors

VirtualMetric
Cozumpark Bilisim Portali
Patching a list of servers with PsExec
Posted in Windows Powershell, Windows Server | No Comment | 912 views | 24/05/2013 09:33

First, you need to install PSTools on your server. Copy psexec.exe and pskill.exe into C:\ directory.

After that you can patch servers like this:

1
2
3
4
5
6
7
8
9
10
11
$Servers = Get-Content "C:\Servers.txt"
foreach ($Server in $Servers)
{
	$PSExecPath = "C:\psexec.exe"
	$PSKillPath = "C:\pskill.exe"
	$Command1 = "C:\cp017534.exe /s"
	$Shell1 = $PSExecPath + " \\" + $Server + " " + $Command1
	cmd.exe /c $Shell1
	$Shell2 = $PSKillPath + " \\" + $Server + " PSEXESVC"
	cmd.exe /c $Shell2
}

cp017534.exe is the hp’s firmware update. It’s located on my servers C:\ directory also.



Leave a Reply