Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Get a list of services and their startup account

$
0
0

I'm trying to do a quick inventory of what startup account each of my servers is using. I wrote the following script, but its not working. Can someone help?

$servers = get-content 'c:\servers.txt'

foreach ($line in $servers)

{

$result = get-wmiobject win32_service -Computer $line | Select-Object name, startname, startmode

echo "ServerName is" $line $result

}

It doesn't appear to like the $line varible after the -computername. If I put just one server name in there it works


Viewing all articles
Browse latest Browse all 15370


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>