PowerTip: Use PowerShell to Check Logon Server for Client


Summary: Use Windows PowerShell to check the logon server of your clients.

Hey, Scripting Guy! Question How can I use Windows PowerShell to verify if my users are trying to sign in to their computers with a Windows account 
           instead of using their domain credentials?

Hey, Scripting Guy! Answer Check the value of the environmental LOGONSERVER variable:

$env:LOGONSERVER

If it reports \\MicrosoftAccount, they are using their Windows account to sign in instead of domain credentials.
You can check this by using the IF statement as shown here:

if($env:LOGONSERVER -match "MicrosoftAccount") {"Logged on with Windows account"}

Comments (1)

Skip to main content