Tuesday, October 4, 2011

Collect Service Info From Remote Servers – PowerShell Script

This PowerShell script can be used to collect Service information from remote machines. 

Input – input.csv, contains all computer names in the following format:

image

Script:

image

Output – Server and service information will in the output file, ServiceInfo.csv

Download – You can download the script from following 2 locations:

  1. www.sivarajan.com - http://www.sivarajan.com/scripts/ServiceInfo.txt
  2. TechNet Script Gallery - http://gallery.technet.microsoft.com/Collect-Service-Info-From-6e3b044e

Update -  10/30/2012 6:15:26 AM

 –append with export-csv is introduced in PowerShell 3.0. So if you are using PowerShell 3.0 just add –append

Otherwise use out-file cmdlet.

So update

get-wmiobject win32_service -computername $Server -Credential $Cred | Select SystemName,DisplayName,StartName,Status | Export-CSV $OutPutFile


with


get-wmiobject win32_service -computername $Server -Credential $Cred | Select SystemName,DisplayName,StartName,Status | Out-File $OutPutFile -encoding ASCII –append




2 comments:

Hello Santhosh,
It's me again. ;)
So, I ran your script and all I get is a bunch of red errors
can't access computer
test-Path : The UNC path should be of the for \\server\share.
at C:\scripts\collectserviceinfor.ps1:10 char:23
+ $adminpath = Test-Path <<<< \\$Server\admin$

I'm running this on my 2003 domain.

Any idea?

Thanks for your help.

Sounds like an Input file issue. Make sure you have “ServerName” as the header in the input file.

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More