There are multiple users logged into the machine. for each user I wanted to print the status (logged in or locked) continuously for each user logged in to the machine. how can get the status of the user. this script will run on each user login using the Scheduler.
$user = $env:UserName
do
{
# Get system Status (Locked or Logged in )
print(status)
Start-Sleep -s 30
} while(1)
How to get the status. Please help me on this.