Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Get the currently logged in user identity via PowerShell

Tags: powershell, identity, iis

Sometimes we need to know exactly our identity. For instance, if we want to set an application pool's identity in IIS, then we need to know exactly how to write our current user identity. This is how.

[Security.Principal.WindowsIdentity]::GetCurrent()

The Name result is the exact way to specify our identity.