Announcement

Collapse
No announcement yet.

VBS- Enum Subkeys of all User Keys

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS- Enum Subkeys of all User Keys

    I need to survey remote hosts and return all mapped drives, conencted UNCs, etc. The best way I have come up with to do this is via enumerating subkeys of
    HKEY_USERS\[UserKey]\Software\Microsoft\Windows\CurrentVersion\Explore r\MountPoints2. The subkeys are the UNC paths of the connections. I have a script that will enumerate all of the user keys (ignoring .DEFAULT and "_CLASSES), but I cannot figure out how to then enumerate each of the subkeys (of the above-listed path) for each user key.

    I cannot rely upon values listed in HKCU as these are servers and there may not be anyone logged in at any given time. Below is the script SO FAR... Any help with this or alternative method suggestions are greatly appreciated.

    ***START OF SCRIPT
    Const HKEY_LOCAL_MACHINE = &H80000002
    Const HKEY_USERS = &H80000003
    Dim strComputer
    Dim HKU

    strComputer = "."
    Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
    HKU = HKEY_USERS
    objReg.EnumKey HKU, "", arrSubKeys
    Dim RegPath, UserPath, UserKey, SubPath
    For Each subkey In arrSubKeys
    UserKey = subkey
    UserPath = HKU & "\" & UserKey
    SubPath = HKU & "\" & UserKey & "\Software\Microsoft\Windows\CurrentVersion\Explor er\MountPoints2"
    If UCase(SubKey) = ".DEFAULT" Or UCase(Right(SubKey, ) = "_CLASSES" Then
    Else
    ' HERE IS WHERE I'M STUCK
    End If
    Next

  • #2
    Re: VBS- Enum Subkeys of all User Keys

    I don't think this will work because only the hives of the users that are currently logged in are loaded in the HKEY_USERS key.

    http://www.petri.com/edit_registry_s...han_myself.htm


    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: VBS- Enum Subkeys of all User Keys

      this script find all mapped drive unc
      use it as a basic and write the resualt
      to a text file:


      Set objNetwork = CreateObject("Wscript.Network")

      Set colDrives = objNetwork.EnumNetworkDrives

      For i = 0 to colDrives.Count-1 Step 2
      strUnc = colDrives.Item(i+1)
      wscript.echo strUnc
      End If
      Next
      Any advice is given in good faith and without warranty.
      Please give reputation points where appropriate.

      Comment

      Working...
      X