The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,842 other followers

Determine Domain and username used when a network share was mapped

Posted by jpluimers on 2016/11/15

Need to research this a bit further as this works:

powershell gwmi -Query 'Select LocalName, RemoteName, UserName from Win32_NetworkConnection'
__GENUS : 2
__CLASS : Win32_NetworkConnection
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 3
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
LocalName :
RemoteName : \\w701ujpl\IPC$
UserName : EN81ENTx64SCAN\jeroenp
PSComputerName :

But this fails for some Powershell versions:

powershell
gwmi -Query 'Select * from Win32_NetworkConnection' | Select-Object LocalName, RemoteName, UserName, ConnectionState | Sort-Object LocalName | ft -auto

–jeroen

Source: user – Determine Domain and username used to map a network drive – Stack Overflow

One Response to “Determine Domain and username used when a network share was mapped”

  1. jpluimers said

    Ondrej Kelle on G+ commented at https://plus.google.com/u/0/+JeroenPluimers/posts/jjng79B8ouf
    WNetGetUser might work, I think.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: