Determine Domain and username used to map a network drive

WMI is your friend:

> wmic netuse where LocalName="Z:" get UserName /value

UserName=rd-pc2037\Administrator

[anonymous suggestion 2022-08-07]:

Since Microsoft is gradually moving away from WMI,
Powershell/CIM is your future friend:

Get-CimInstance -classname Win32_NetworkConnection | select-object Remotename,Username

Leave a Comment