Lansweeper logo
Home Download Features Demo Buy now Help Support forum
 
    Most requested support articles:
  Lansweeper troubleshooting guide.
  The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
  WMI Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  How to configure the windows firewall using group policies.
  Support:  
 support@lansweeper.com  
Skype: Lansweeper  
  Mo-Fri 9h-17h CET  
Welcome Guest Search | Active Topics | Log In | Register

Untag as favorite
Drive mappings from remote computers??
progdlp
#1 Posted : Wednesday, May 05, 2010 11:56:49 PM

Rank: Premium user

Groups: Premium Users
Posts: 34
Location: US-Oklahoma
Is there a way to get drive mappings for all computers on a network in lansweeper?
Lansweeper
#2 Posted : Thursday, May 06, 2010 9:27:03 AM

Rank: Administration

Groups: Administration, Premium Users
Posts: 10,370
This is currently not possible, I suggest to add it to the wishlist.
i.kulgu
#3 Posted : Tuesday, May 11, 2010 11:37:07 AM

Rank: Premium user

Groups: Premium Users
Posts: 70
Location: Holland
You can do this with a vbscript.
Get the script below and copy it to your actionpath.
Make a computer action like : {actionpath}driver_mapping.vbs
That should do the trick.

Ps. if you can change the script where you can get all the outputs in 1 screen would work better, i couldn't manage to do that.
File Attachment(s):
drive_mapping.zip (1kb) downloaded 76 time(s).
mattglg
#4 Posted : Monday, August 02, 2010 12:36:08 PM

Rank: Premium user

Groups: Member, Premium Users
Posts: 1
I use a modified vbscript from the MS Script Centre for this. The custom action is just {actionpath}RemoteDrives.vbs {computer}

Code:
'Define variables, constants and objects

strComputer = Wscript.Arguments.Item(0)
strOutput=""
Const HKEY_USERS = &H80000003
Set objWbem = GetObject("winmgmts:")
Set objRegistry = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
Set objWMIService = GetObject("winmgmts:"  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

'Go and get the currently logged on user by checking the owner of the Explorer.exe process. 

Set colProc = objWmiService.ExecQuery("Select Name from Win32_Process" & " Where Name='explorer.exe' and SessionID=0")

If colProc.Count > 0 Then
    For Each oProcess In colProc
        oProcess.GetOwner sUser, sDomain
    Next
End If

'Loop through the HKEY_USERS hive until (ignoring the .DEFAULT and _CLASSES trees) until we find the tree that
'corresponds to the currently logged on user.
lngRtn = objRegistry.EnumKey(HKEY_USERS, "", arrRegKeys)    
    
For Each strKey In arrRegKeys
    If UCase(strKey) = ".DEFAULT" Or UCase(Right(strKey, 8)) = "_CLASSES" Then
    Else

        Set objSID = objWbem.Get("Win32_SID.SID='" & strKey & "'")

'If the account name of the current sid we're checking matches the accountname we're looking for Then
'enumerate the Network subtree
        If objSID.accountname = sUser Then
            regpath2enumerate = strkey & "\Network" 'strkey is the SID
            objRegistry.enumkey hkey_users, regpath2enumerate, arrkeynames
                
'If the array has elements, go and get the drives info from the registry
            If Not (IsEmpty(arrkeynames)) Then
                For Each subkey In arrkeynames
                    regpath = strkey & "\Network\" & subkey
                    regentry = "RemotePath"
                    objRegistry.getstringvalue hkey_users, regpath, regentry, dapath
'                    'wscript.echo subkey & ":" & vbTab & dapath
                    stroutput = stroutput & subkey & ":" & vbTab & dapath & vbCr
                Next
            End If
        End If
    End If
Next
strOutput="Drives for user " & suser & " using PC "& strComputer & vbCr & vbCr & stroutput
wscript.echo stroutput
File Attachment(s):
RemoteDrives.zip (2kb) downloaded 55 time(s).
Merick1983
#5 Posted : Friday, December 10, 2010 1:55:09 PM

Rank: Premium user

Groups: Member, Premium Users
Posts: 12
i.kulgu wrote:
You can do this with a vbscript.
Get the script below and copy it to your actionpath.
Make a computer action like : {actionpath}driver_mapping.vbs
That should do the trick.

Ps. if you can change the script where you can get all the outputs in 1 screen would work better, i couldn't manage to do that.



The following may do what you wanted.. I noticed in your script that you'd set "Connect" but not used it so it only ever returned the mapped drives of the local PC, not the remote PC... anyway... Save the following as "Drive_Mapping.vbs"

Code:

CompName = wscript.arguments.Item(0)
set wshShell=CreateObject("wscript.shell")

Set objWMI = GetObject("winmgmts:\\" & CompName & "\root\cimv2")


Set oDrives = objWMI.ExecQuery("select * from Win32_MappedLogicalDisk")


strTitle="Network Drive Mappings"

strmsg="Drive Mappings on " & CompName & vbcrlf & vbcrlf


For Each objDrive in oDrives
strMsg=strMsg & ObjDrive.DeviceID & "  " & objDrive.ProviderName & vbcrlf
Next

wshShell.Popup strMsg,-1,strTitle,vbinformation


and add your custom action as.... {actionpath}Drive_Mapping.vbs {computer}

Note that this can sometimes take a while to enumerate the "objDrive.ProviderName"
Users browsing this topic
Guest
Untag as favorite
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Contact: E-mail Lansweeper - Skype : Lansweeper
Copyright 2004 - 2011 © Hemoco bvba