VMware Workspace ONE Community
mabdelhamid
Enthusiast
Enthusiast

Windows 10, retrieve logged in user

Hello,

Is there a way to retrieve current Windows 10 logged in user (Not the enrollment user), Windows 10 Devices are shared between employees and we need to tell who is currently logged to the device.

 

Thanks in advance

Labels (1)
Tags (1)
Reply
0 Kudos
4 Replies
ogushia
Hot Shot
Hot Shot

We had the same requirements before, and I was able to get the logged-in user using a sensor like the one below.

$ActiveSession = (quser | Where-Object {$_ -match 'Active'}).Remove(0, 1)
$ActiveUser = ($ActiveSession -split ' +')[0]
write-output $ActiveUser

Reply
0 Kudos
RoderikdeBlock
Enthusiast
Enthusiast

Or 

$User = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name

Write-Output $User

Roderik de Block


Blog: https://roderikdeblock.com
Reply
0 Kudos
mabdelhamid
Enthusiast
Enthusiast

Thanks all, the deployment is on-prem, Sensor is not available.

Reply
0 Kudos
edgarastrov
Contributor
Contributor

Is there a way to push it to console so it can be seen from CN rather than intelligence reports?

Reply
0 Kudos