October 15, 2013

Active Directory - Service Accounts

Looking for Service Accounts in your Active Directory?

Get-WmiObject Win32_Service -comp (Get-ADComputer -filter * -SearchScope Subtree -searchbase 'OU=ServersOU,DC=domain,DC=com'| where {$_.enabled -like "True"} | select -expand name) | where-object { ($_.startname -ne "LocalSystem") -and ($_.startname -ne "NT AUTHORITY\LocalService") -and ($_.startname -ne "NT AUTHORITY\NetworkService") -and ($_.startname -ne "NT AUTHORITY\LOCAL SERVICE") -and ($_.startname -ne "NT AUTHORITY\NETWORK SERVICE") -and ($_.startname -ne "NT AUTHORITY\SYSTEM")} | select SystemName,name,startname,startmode,State,status | export-csv C:\Folder\ServiceAccounts.csv

No comments:

Post a Comment