With someone on another forum I created a script to check services on all the servers running under an administrator account.
Also I wanted the script to log every server.
Still something not right with the script. The output is empty. I know a server that is running services with administrator account.
If I put this servername last in the serverlist(allwindows.csv), I do get an output. If I put this servername in de middle or someplace else, no output in serverlist.htm. Seems like only the last server in the list is “scanned”, although I see every server in the logfile
$a = “<style>”
$a = $a + “BODY{background-color:#012456;}”
$a = $a + “H2{color:White;}”
$a = $a + “TABLE{border-width: 2px;border-style: solid;border-color:white;border-collapse: collapse;}”
$a = $a + “TH{border-width: 2px;padding: 10px;border-style: solid;border-color:white;color:#FFFFFF;}”
$a = $a + “TD{border-width: 2px;padding: 10px;border-style: solid;border-color: white;color:white}”
$a = $a + “</style>”
You’re overwriting ServerList.htm every time through the loop with that call to Out-File. What you’re probably looking to do is something more like this (moving the calls to ConvertTo-Html and Out-File outside the loop):
On a side note, this script doesn’t actually identify services running as a Domain Admin account (which would imply you should be checking for group membership). It just looks for services running as any account with “Administrator” in the name.
Thank you, thank you…
I’ve been troubleshooting this for 3 days with someone on the microsoft TechNet forum, and you fix it in 5 or less minutes…
I notice the Microsoft guy was a beginner, but hey, everybody got to start somewhere. I’m a powershell dummy…
And you’re side note is true. The subject of this post should be “Services using Administrator account”
I want to be sure to get every service with any administrator account, domain\administrator or administrator@domain or just administrator.
We our going to changed (domain)administrator passwords
Anyway, thanx again