Link to home
Start Free TrialLog in
Avatar of morian
morian

asked on

Power shell script

Does anyone have a sample power shell script that can list the automatic windows services on a list of servers from a csv file that is started?
ASKER CERTIFIED SOLUTION
Avatar of Muhammad Burhan
Muhammad Burhan
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This only lists Services set to Automatic

Display
$Computers = Get-Content C:\Temp\Computers.txt;
Get-Service -ComputerName  $Computers | Where-Object {$_.StartType -eq "Automatic"} | Select Name, StartType, Status, MachineName | Sort Machinename | Format-Table -AutoSize

Open in new window


Output to CSV
$Computers = Get-Content C:\Temp\Computers.txt;
Get-Service -ComputerName  $Computers | Where-Object {$_.StartType -eq "Automatic"} | Select Name, StartType, Status, MachineName | Sort Machinename | Format-Table -AutoSize | Export-CSV C:\Temp\Out.csv

Open in new window