Retrieve the System Accounts
Scenario/Problem: You need to retrieve system account objects.
Solution: Use the Get-SPProcessAccount
cmdlet.
Issuing the Get-SPProcessAccount
cmdlet without any parameters displays all system and managed accounts on the SharePoint farm, as shown in Figure 1.
Figure 1. Get-SPProcessAccount displays all system and managed accounts.
Several mutually exclusive switch parameters can retrieve a specific system account. The switch parameters are LocalSystem
, LocalService
, and NetworkService
. Use these separately, as shown in Listing 1.
Listing 1. Retrieving Individual System Accounts
Get-SPProcessAccount -LocalSystem
Get-SPProcessAccount -LocalService
Get-SPProcessAccount -NetworkService
Tip
Pipe the result to other cmdlets that accept process accounts or assign the result to a variable for use within a cmdlet script.
Retrieve Managed Accounts
Scenario/Problem: You need to retrieve managed accounts on the farm.
Solution: Use the Get-SPManagedAccount
cmdlet.
Issuing the Get-SPManagedAccount
cmdlet without any parameters displays all managed accounts on the
SharePoint farm. To retrieve a specific managed account, you can use
the account name, as shown in Listing 2.
Listing 2. Retrieving a Specific Managed Account
Get-SPManagedAccount "SP\Administrator"
Tip
Pipe the result to other cmdlets that accept managed accounts or assign the result to a variable for use within a cmdlet script.