Sign in to follow this  
Followers 0
Methos

List mapped network connections

4 posts in this topic

Hi all, thanks for reading this. I've been working on this for a couple hours now and can't seem to find a solution.

Problem: I can't get a list of mapped connections with autoit/wmi.

for example, if you are using a command line, a simple 'net use' brings up a list of drives. For connections you have not specified a drive letter for, I want to find a way to diferentiate between them. Through WMI I can pull a list of drives - but only ones that have been mapped with a letter.

Has anyone else ran into this, or do you have any ideas for me?

Thanks in advance

-John

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi all, thanks for reading this. I've been working on this for a couple hours now and can't seem to find a solution.

Problem: I can't get a list of mapped connections with autoit/wmi.

for example, if you are using a command line, a simple 'net use' brings up a list of drives. For connections you have not specified a drive letter for, I want to find a way to diferentiate between them. Through WMI I can pull a list of drives - but only ones that have been mapped with a letter.

Has anyone else ran into this, or do you have any ideas for me?

Thanks in advance

-John

moin, moin...;)!

why do you want to read it from wmi more easy is to read in the registry. Maybe you try it like this:

Code

For $i = 65 to 90 Step +1
    $Path = RegRead("HKEY_CURRENT_USER\Network\" & Chr($i), "RemotePath")
    If $Path = "" Then
    
    Else
        MsgBox(0, "Mapped Sharedrive " & Chr($i), $Path)
    EndIf 
Next

i hope it helps... :lmao:

Edited by rudika

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Share this post


Link to post
Share on other sites

moin, moin...;)!

why do you want to read it from wmi more easy is to read in the registry. Maybe you try it like this:

Code

For $i = 65 to 90 Step +1
    $Path = RegRead("HKEY_CURRENT_USER\Network\" & Chr($i), "RemotePath")
    If $Path = "" Then
    
    Else
        MsgBox(0, "Mapped Sharedrive " & Chr($i), $Path)
    EndIf 
Next

i hope it helps... :lmao:

...and this could be the way with wmi

$RemotePath = ""
$LocalName = ""
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery ("Select * from Win32_NetworkConnection")
For $objItem In $colItems
    $LocalName = $objItem.LocalName
    $RemotePath = $objItem.RemotePath
    MsgBox(0, "Mapped Sharedrive " & $LocalName, $RemotePath)
Next

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Share this post


Link to post
Share on other sites

This is a great thread, but you might check the AutoIt docs for the DriveGetDrive function.


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

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  
Followers 0