Ying Li at myITforum.com

PowerShell & System Center

Powershell Script to check against a list of computers and see if the Automatic Update Service is running

This Powershell script will get a list of server or machine names from a text file named MachineList.txt and return the status of Automatic Updates service and start the service if it is not running.

$erroractionpreference = "SilentlyContinue"
$a = get-content "C:\Temp\Machinelist.txt"
Foreach ($i in $a)
{$b = get-wmiobject win32_service -computername $i -Filter "Name = 'wuauserv'"
If ($b.state -eq "stopped")
{$b.startservice()
write-host "Window update service is started for $i"}
else
{write-host "Window update service is already started for $i"}
}

Posted: Dec 12 2006, 01:44 PM by yli628 | with no comments
Filed under:

Comments

No Comments