Hi community,
please let me know how to Display the current logged in user from a windows 7 Workstation.
I´ve tryed the scripts\check_users.exe and *.ps1 but it works only on Server 2008 R2 and higher.
I got the result as follow
Server 2008 R2= OK: Domain\User is currently loggen in
Windows 7 = OK: \ is currently loggen in
The Background:
I've 10 rooms with doctors and I need to know which doctor is logged on to the Workstation.
The result will be displeyed in Nagvis to identify for the secretary.
Sincerely,
Alex
How to check currently logged in users in windows 7
Re: How to check currently logged in users in windows 7
The following powershell script (I named it check_users.ps1) worked against my Windows 7 machine:
My NSClient++ (0.4.x) command configuration:
Testing it from the Nagios XI server:
No users logged in:
Code: Select all
$computername = 'localhost'
$user = Get-WMIObject Win32_Process -filter 'name="explorer.exe"' -computername $ComputerName |
ForEach-Object { $owner = $_.GetOwner(); '{0}\{1}' -f $owner.Domain, $owner.User } |
Sort-Object | Get-Unique
if(!$user) {Write-Host ""}
else {Write-Host $user}
Code: Select all
[/settings/external scripts/scripts]
check_users = cmd /c echo scripts\check_users.ps1; exit($lastexitcode) | powershell.exe -command -
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.4.240 -c check_users
Aaron-PC\Aaron
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.4.240 -c check_users
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/