Jump to content
Sign in to follow this  

Enum Network connections

Recommended Posts

Hi !

I'm looking for a way to enum all mapped drives and connections etablished (like the Windows command net use [ENTER])

I don't know how to use the _WinNet_EnumResource() function... Is there a way with it ?

Thank you for your help...

Share this post

Link to post
Share on other sites

This info can also be found via WMI.


$host = "."
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $host & "\root\cimv2")
$colItems = $objWMIService.ExecQuery ("SELECT * from Win32_NetworkConnection")
$conn = 0
For $objItem in $colItems
    $conn += 1
    $info = "Name: " & $objItem.Name & @CRLF & "ConnectionState: " & $objItem.ConnectionState & @CRLF & "ConnectionType: " & $objItem.ConnectionType & @CRLF & "LocalName: " & $objItem.LocalName & @CRLF & "RemotePath: " & $objItem.RemotePath
    msgbox(0,"MAP " & $conn,$info)
Edited by spudw2k

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...