Last Update: November 16, 2012
PowerShell Version: 2.0 and 3.0
Libraries:
- PSv3.psm1
.SYNOPSIS
Discovers all the logon accounts used on service accounts
.DESCRIPTION
Discovers all the services running on a list of servers piped into the
cmdlet and the logon accounts for those services.
The list of servers must be piped in to this cmdlet.
.PARAMETER AllAccounts
Returns services that have logon accounts of LocalServer or NT AUTHORITY.
Without this switch, only services that do not utilize LocalService or
NT AUTHORITY will be returned.
.PARAMETER Quiet
Suppresses the online status display on the monitor.
.EXAMPLE
"Indy1", "Indy2", "Indy3" | Find-ServiceAccounts
Returns the online status of each server, the services running on all servers,
and the service account used for the services logon account ina list format.
Any service listed as N/A does not exists on that particular server. Only
services with a logon account that is not a LocalSystem or NT AUTHORITY
account will be listed.
.EXAMPLE
"Indy1", "Indy2", "Indy3" | Find-ServiceAccounts | FT
Check Server LON-DC1 : Online
Check Server NotOnline : OffLine
Check Server LON-SVR3 : Online
ComputerName Online BITS hkmsvc NcaSvc Appinfo
------------ ------ ---- ------ ------ -------
Indy1 True .\Webservice$ ADATUM\Acco... ADATUM\Acco... N/A
Indy2 False N/A N/A N/A N/A
Indy3 True N/A N/A N/A ADATUM\Acco...
Returns the online status of each server, the services running on all servers,
and the service account used for the services logon account. Any service
listed as N/A does not exists on that particular server. Only services
with a logon account that is not a LocalSystem or NT AUTHORITY account
will be listed.
.EXAMPLE
"Indy1", "Indy2", "Indy3" | Find-ServiceAccounts -Quiet | FT
ComputerName Online BITS hkmsvc NcaSvc Appinfo
------------ ------ ---- ------ ------ -------
Indy1 True .\Webservice$ ADATUM\Acco... ADATUM\Acco... N/A
Indy2 False N/A N/A N/A N/A
Indy3 True N/A N/A N/A ADATUM\Acco...
Returns the online status of each server, the services running on all servers,
and the service account used for the services logon account. Any service
listed as N/A does not exists on that particular server. Only services
with a logon account that is not a LocalSystem or NT AUTHORITY account
will be listed. This example will not display its progress in contacted
each server.
.EXAMPLE
"Indy1", "Indy2", "Indy3" | Find-ServiceAccounts -AllAccounts | FT
Returns the online status of each server, the services running on all servers,
and the service account used for the services logon account. Any service
listed as N/A does not exists on that particular server.
.EXAMPLE
"Indy1", "Indy2", "Indy3" | Find-ServiceAccounts | Where-Object {$_.Online -eq $True} | Format-table
Check Server LON-DC1 : Online
Check Server NotOnline : OffLine
Check Server LON-SVR3 : Online
ComputerName Online BITS hkmsvc NcaSvc Appinfo
------------ ------ ---- ------ ------ -------
Indy1 True .\Webservice$ ADATUM\Acco... ADATUM\Acco... N/A
Indy2 False N/A N/A N/A N/A
Indy3 True N/A N/A N/A ADATUM\Acco...
Returns the services running on all servers that are currently online
and the service account used for the services logon account. Any service
listed as N/A does not exists on that particular server. Only services
with a logon account that is not a LocalSystem or NT AUTHORITY account
will be listed.
.NOTES
All servers must be able to return a ping. If the Windows Firewall is
turned on, you must enable inbound firewall rule:
File and Printer Sharing (Echo Request - ICMPv4 -In)
===============================================================================
Copyright 2012 MCTExpert, Inc.
Licensed for use by participants from classes delivered by Jason Yoder.
This script is provided without support, warranty, or guarantee.
User assumes all liability for cmdlet results.
===============================================================================
This code has been tested in a Windows Server 2012 domain.