hcds
asked on
Get-Service Log on as
Hi,
looking for a powershell script to accomplish the following task:
- list services of a remote computer
- get information about the "log on as" attribute such as local system or else
my actual script is:
#list services of a remote computer
"Computer:"
$serviceComputer = [Console]::ReadLine()
$serviceComputer = $serviceComputer.Trim()
$now = get-date -uformat %d.%m.%y
$outputfile = "services_" + $strComputer + "_" + $now + ".txt"
Get-Service -Computername $serviceComputer |Sort-Object -property ServiceType | format-Table name, status, CanStop, -auto | out-file -filepath $outputfile
looking for a powershell script to accomplish the following task:
- list services of a remote computer
- get information about the "log on as" attribute such as local system or else
my actual script is:
#list services of a remote computer
"Computer:"
$serviceComputer = [Console]::ReadLine()
$serviceComputer = $serviceComputer.Trim()
$now = get-date -uformat %d.%m.%y
$outputfile = "services_" + $strComputer + "_" + $now + ".txt"
Get-Service -Computername $serviceComputer |Sort-Object -property ServiceType | format-Table name, status, CanStop, -auto | out-file -filepath $outputfile
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you go for CSV then all you need is:
Get-WmiObject Win32_Service -Computer $serviceComputer | `
Sort-Object ServiceType | `
Select-Object Name, Status, StartName | `
Export-CSV "SomeFile.csv"
If you want simple text then:
Get-WmiObject Win32_Service -Computer $serviceComputer | `
Sort-Object ServiceType | `
Select-Object Name, Status, StartName | `
Format-Table -Auto > "SomeFile.txt
Or you can convert it to HTML or something else entirely depending on your goals :)
Chris
ASKER
with WMI i got it done!
One single question remaining: how can i pipe this into a text-file?
Christoph