July 29th, 2015

PowerTip: Use PowerShell to Check Logon Server for Client

Doctor Scripto
Scripter

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"}

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback