Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Finding Service Accounts on a Windows server

$
0
0

Hello,

Im trying to find the service accts that are not localsystem, NT AUTHORITY\LocalService  or NT AUTHORITY\NetworkService

Here is what I have so far.

Clear-Host

get-content

 

 

c:\temp\servers.txt |ForEach-Object {$_

Get-WmiObject

 

 

 

win32_service-ComputerName$_ |Where-Object {$_.StartName -ne'LocalSystem'} |Sort-Object-PropertyDisplayname |format-table Displayname,StartName}

I can remove the one of the built-in logon accounts from the list. But I'm not having much luck buidling the "IF" statement using and\or .


Viewing all articles
Browse latest Browse all 6937

Trending Articles