Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get automatic update service status from remote machines 1

Status
Not open for further replies.

pagy

Technical User
Sep 23, 2002
1,162
0
0
GB
Hi folks,

I need to check on the automatic updates service (wuauserv) on all machines in my domain, I have a feeling it's not running on a large number of them!!

I have powershell v2 on my machine at the moment and I can do get-service -include wuauserv -computer computername to get the status from a single remote machine.

How do I get Powerhsll to read a list of remote machines to query and then how to format that info properly into a spread sheet? Or does anyone know of any other way to do this?

Pointers in the right direction please..

Paul
VCP4

RFC 2795 - The Infinite Monkey Protocol Suite (IMPS)

Difficult takes a day, impossible takes a week
 
Depending on the number of machines, you could put them in a text file:
Code:
machine1
machine2
machine3
then do the following:
Code:
get-content filename.txt | foreach {get-service -name wuauserv -computer $_} | select MachineName, Name, Status | export-csv -path c:\wuservice.csv -encoding 'ASCII' -notypeinformation
then open the CSV in Excel.

If you have the AD cmdlets from Quest Software, you could get all computers in the domain with Get-QADComputer and run the output through the same process (with 1 or 2 minor changes)

 
That is awesome, thanks.. That works brilliantly

I do have the quest AD cmdlets, could you enlighten me as to what the 1 or 2 minor changes would be please? I would be interested to see that as well..





Paul
VCP4

RFC 2795 - The Infinite Monkey Protocol Suite (IMPS)

Difficult takes a day, impossible takes a week
 
In a basic form, you could do this, retrieving information for all Domain Controllers for instance:
Code:
Get-QADComputer -SearchRoot 'domain.com/Domain Controllers' | Foreach {Get-Service -Name wuauserv -ComputerName $_.Name} | Select MachineName, ServiceName, Status
If you have machines that are offline during the check you'll get errors. You'd probably want to expand this to a script and only make the call to online machines. The following uses a PowerShell v2 cmdlet (test-connection), but the same thing can be done in v1 using WMI.
Code:
# Set up an empty array
$list = @()

# Get all of the domain controllers
Foreach ($c in Get-QADComputer -SearchRoot 'domain.com/Domain Controllers')
    {
        # Make sure it's alive
        If (Test-Connection -ComputerName $c.Name -Count 2 -Quiet)
            {
                $list += Get-Service -Name wuauserv -ComputerName $c.Name
            }
    }

$list |
 Select MachineName, ServiceName, Status |
 Export-CSV -Path c:\wuservice.csv -Encoding 'ascii' -NoTypeInformation
Depending on where you store your computer accounts, you could change the searchroot to 'domain.com/computers' or 'domain.com/ou/ou/ou'. You could add parameters to check for different service names or computer locations.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top