
IT Department (Customer) asked a question.
Need a script to use in WUG to show which user is login to some devices
Hello guys,
need a script to use in WUG to show which user is login to some devices. any ideas pls? I want a specific user to be login all the time otherwise the application wont work.. so WUG need to alert me if that specific user/account is logged off
An easier way, you could do it with a Windows Event Passive Monitor and look for Event ID 4647 and put the user name / userID in the "match" on section.
Hi
I would try a PowerShell active monitor for this. Something like below should work
$resultTextPass = "User logged in"
$resultTextFail = "User not logged in"
$loggedInUser = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty UserName
if ($loggedInUser -eq "domain\user") {
$Context.SetResult(0,$resultTextPass);
} else {
$Context.SetResult(1,$resultTextFail);
}
Ok, Here's one that should work on a remote computer after you create a PowerShell Active Monitor.
Please NOTE, and it is an important one. the Win32_ComputerSystem won't show users logged in via RDP.
Hello Mike,
looks like powershell is not enable only active script-vbscript is allwoed
PowerShell isn't enabled on the remote machine? Here's Microsoft's article on how to enable it.
Thanks , i will try and update you.