LLI Wiki — My Digital Knowledge Base

List Windows, IIS and Hyper-V identities in PowerShell

PowerShell commands to list the accounts, Windows services, IIS application pools and Hyper-V virtual machines on a server.

These PowerShell commands list the identities on a Windows server: Windows accounts, Windows services, IIS application pools and Hyper-V virtual machines. They can be used, for example, to rebuild the list of accounts granted the "Log on as a service" right after a Group Policy has overwritten it.

All Windows accounts

get-wmiobject -class "win32_account" -namespace "root\cimv2" | sort caption | format-table caption, __CLASS, FullName

Windows services

get-service | foreach {Write-Host SERVER01 Service\$($_.Name)}

IIS application pools

get-WebConfiguration system.applicationHost/applicationPools/* /* | where {$_.ProcessModel.identitytype -eq 'ApplicationPoolIdentity'} | foreach {Write-Host SERVER01 APPPOOL\$($_.Name)}

Hyper-V virtual machines

get-vm | foreach {Write-Host SERVER01 VIRTUAL MACHINE\$($_.Id) - $($_.VMName)}

Notes

The service, IIS and Hyper-V commands print SERVER01 as the machine name: replace it with your server's name.

Mastodon LLIMastodon SocialFosstodon