Query Mapped Network Drives/Paths


  • Tasked with Reporting all mapped network drives/paths on each machine prior to the decommisioning of DFS.
    I'm able to Report Disk and LogicalDisk information, but have not found the right class/object to Report "mapped network drives/paths" on machines.

    Could anyone point me the right way ?

    Thx !!!!
    Tuesday, June 02, 2009 8:37 PM


All replies

  • Look at DataShift - Drives found on site.
    Tuesday, June 02, 2009 9:14 PM
  • Also note that mapped drives are part of a user's profile and not the system, so no query will be 100% complete until every user logs on to a system and has their mapped drive configuration stored/reported. If a user does not log on, their mapped drive data will not be reported on.

    Just one of many reasons why mapped drives are evil.

    Jason |
    Tuesday, June 02, 2009 9:53 PM
  • A very good utility indeed. I tore apart the VBS and do not believe the classes enclosed are going to meet the "network mapped drive" requirements.
    Tuesday, June 02, 2009 10:25 PM
  • Why do you say that? That is one of the main reason why people use it.
    Tuesday, June 02, 2009 11:26 PM
  • Well, all I can say is I used the datashift.vbs for years (that company still is using it) to find all the mapped network drives.  It was used for a project to find "who is connected to serverX" during a decommission and replace of ServerX.  I know it works.  Also used the printer part of the script during a printer migration--to know who to migrate.  the local admins worked for a while (until we got Vista, and things changed there; but if you care about that, there's a different routine for local admin).

    Maybe this will help:
    and/or the Mini Monster MOF Builder has the datashift mof edits for sms_def.mof (the script creates the structure, no configuration.mof edits needed):

    You might want to just use the drive datashift mof edit and script; the local admin part of the script is only accurate for XP workstations or less, and the local shares is boring (to me--you can get that from a default class in sms_def.mof if you need it).  Printers may or may not be useful.
    Standardize. Simplify. Automate.
    Wednesday, June 03, 2009 1:57 AM
  • I must have missed something. I'll look again.

    Thanks you everyone for your post. These have been very helpful getting me in the right direction.

    Thursday, June 04, 2009 3:47 PM
  • Hello all-

    Great post....I've never used any of those Datashift scripts and they look pretty sweet.
    Just to inventory Mapped Network Drives:

    1.  Run DataShift_Drives.vbs on the Site Server...
    2.  Restart sms_executive and site_component_manager Service
    3.  Run datashift_drives.vbs on the client

    Is this how it goes?

    Friday, September 25, 2009 1:52 PM
  • you do not run datashift_drives.vbs on the site server.

    Well, only if that site server "happens" to be a client anyway, and you want it (as a client) to tell the database about it's network drive mappings.

    What you need to do it edit (using notepad) inboxes\clifiles.src\hinv\sms_def.mof on each primary site with clients where the clients will run the vbs script.  In that sms_def.mof file skip to the end, and paste in the mof edit for the drives piece of datashift.  Which, according to the Mini Monster Mof Builder, is this:

    // SMS Expert MOF modifications
    #pragma namespace("\\\\.\\root\\cimv2\\sms")
    [SMS_Report(TRUE), SMS_Group_Name("SMX Drives"), SMS_Class_ID("SMXDRIVES")]
    class SMX_Drives : SMS_Class_Template
      [SMS_Report(TRUE)] boolean Compressed;
      [SMS_Report(TRUE)] string Description;
      [SMS_Report(TRUE)] string DeviceID;
      [SMS_Report(TRUE)] uint32 DriveType;
      [SMS_Report(TRUE)] string FileSystem;
      [SMS_Report(TRUE)] uint64 FreeSpace;
      [SMS_Report(TRUE)] uint32 MediaType;
      [SMS_Report(TRUE), Key] string Name;
      [SMS_Report(TRUE)] string ProviderName;
      [SMS_Report(TRUE)] uint64 Size;
      [SMS_Report(TRUE)] string VolumeName;
      [SMS_Report(TRUE)] string VolumeSerialNumber;

    At the 10,000 foot level... Client (when a user is logged in, *and* the client has rights to WMI) runs the vbscript to place the data into wmi.  You've edited the mof to change the hardware inventory policy.  Client get's the new hinv, and will report up the new data that's in WMI, since it now has a policy telling it to do so.
    Standardize. Simplify. Automate.
    Friday, September 25, 2009 2:51 PM
  • Very nice!    If users do not have administrator rights, what do you think would be the best way to write the data?  wmisecurity.exe?

    Friday, September 25, 2009 3:19 PM
  • I don't know what would be best; I tried (once) to figure out a way, like creating the wmi locations first (as SYSTEM, via "run another program first"), and opening up the WMI permissions to the end user for that specific namespace section, and then a (heavily modified) datashift-drives.vbs to run as the user and populate the (now security opened) wmi namespace.  But I never did finish that...

    If you get a method that works, please share; I can see where some companies would find that procedure to be very useful.

    Standardize. Simplify. Automate.
    Friday, September 25, 2009 7:50 PM
  • Me again! 

    I've been using the Datashift-Drives.vbs and it works great (when runing it manually).
    Does anyone know of a way to run it from SCCM as SYSTEM (not even sure if it'llwork).

    I tried the command 'cscript.exe Datashiftdrives.vbs', and it runs successfully from SCCM. 
    Afterwards, I'll force a Hardware Inventory, then check the targets Resource Explorer.
    The Class is there but no Network Drive information (even if the script is run on a system where the current signed on user is local admin).
    But if I go to that machine and run the scipt and then run the inventory, it works.

    Is there something incorrect in the command syntax?  or is this just not possible to run successfully via SCCM?


    Wednesday, November 11, 2009 9:13 PM
  • This is on Windows 7 or Windows 2008, right?
    Wednesday, November 11, 2009 9:23 PM
  • Hey Garth-

    Windows XP and Server 2003.

    The script works great when run manually.  Like...superfast!
    Just through SCCM, I can't get the desired output.
    Wednesday, November 11, 2009 9:25 PM
  • On the program, what do you have the Run Mode set to? Admin or User?
    Wednesday, November 11, 2009 9:30 PM
  • Program runs as Admin \ whether or not a user is signed on.

    I checked the box that 'Allows users to Interact..."

    This is the command i'm using:   cscript.exe DataShift-Drives.vbs

    Wednesday, November 11, 2009 9:37 PM
  • Mapped drivers are specific to each user and are not shared or part of the entire system in any way. Thus, inventorying the mapped drives of the SYSTEM account results in no drives because the SYSTEM account does not have any mapped. You must run this script as the user whose mapped drives you would like to map.
    Jason | | | Twitter @JasonSandys
    Wednesday, November 11, 2009 10:12 PM
  • Jason it right, it will not inventory mapped drives of a users when run in Admin mode. (However, It will get you the info for the local drives.)

    If you need the mapped drivers then you need to change the Run Mode to User, then everything will be ok.
    Wednesday, November 11, 2009 11:37 PM
  • Thanks guys!!!
    Thursday, November 12, 2009 1:03 PM
  • Sorry to dig this old thread up, but I'm looking at running the DataShift-drives script to return mapped drive data and am confused as to how are people are getting the data into WMI when the script requires the user to be a local admin to get the data into WMI, which by default, 'autenticated users' aren't able to do.
    Friday, October 22, 2010 8:05 AM
  • Although I have not done this, you could change the permission on that WMI class to allow “users” the rights to “add/delete” from that class. This would mean it was a two stage process.
    Friday, October 22, 2010 10:42 AM
  • Can I ask how those that have deployed this script managed to get round the permissions issue? It seems to me reading the thread and other threads on the subject that many people have successfully deployed it and are returning the data, but without changing WMI permissions, the thing won't work!!!

    Friday, October 22, 2010 1:34 PM
  • To my knowledge no one has made this work without requiring Admin access or without a two-step process.
    Saturday, October 23, 2010 4:23 PM
  • OK so dont kill me for reviving this old thread...

    But has anyone actually done this multi-step process for giving a non admin user rights to create/update the wmi namspace section?  I briefly looked at this, but is it even possible to change security for just the SMX_Printer section?  Wouldnt it have to be for the entire root\cimv2\sms?  If anyone has done this could you please share how you did it?  :)

    Thursday, July 21, 2011 8:16 PM
  • In case anyone is curious, my thought is that you could first run this script (as SYSTEM) to open security on root\cimv2\sms:

    strSD = array(1, 0, 4, 129, 132, 0, 0, 0, 148, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 2, 0, 112, 0, 5, 0, 0, 0, 0, 0, 20, 0, 28, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 11, 0, 0, 0, 0, 18, 24, 0, 63, 0, 6, 0, 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0, 0, 18, 20, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 20, 0, 0, 0, 0, 18, 20, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 19, 0, 0, 0, 0, 18, 20, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 11, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0, 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0)
    set namespace = createobject("wbemscripting.swbemlocator").connectserver(,"root\CIMV2\sms")
    set security = namespace.get("__systemsecurity=@")
    nStatus = security.setsd(strSD)

    Then run the datashift script with the user credentials to populate the namespace, then run this script (as SYSTEM) to set security in wmi back to normal:

    strSD = array(1, 0, 4, 129, 112, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 2, 0, 92, 0, 4, 0, 0, 0, 0, 18, 24, 0, 63, 0, 6, 0, 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0, 0, 18, 20, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 20, 0, 0, 0, 0, 18, 20, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 19, 0, 0, 0, 0, 18, 20, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 5, 11, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0, 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0)
    set namespace = createobject("wbemscripting.swbemlocator").connectserver(,"root\CIMV2\sms")
    set security = namespace.get("__systemsecurity=@")
    nStatus = security.setsd(strSD)

    In tests it seems to work well...

    Thursday, July 21, 2011 8:33 PM
  • So it sound like you have it setup as a 3 step process, right?

    1. Setup the class and change security
    2. Run in user mode
    3. Re-setup security on the Cimv2
    Thursday, July 21, 2011 10:29 PM
  • correct

    but im not sure its the most elegant way to do this

    Thursday, July 21, 2011 11:30 PM
  • IMO is not the best way to do this and it would seem like it is begging for trouble. But if it works for you then…
    Friday, July 22, 2011 11:10 AM
  • no i agree with you - i dont like it either

    so im looking for some alternative suggestions :)

    Friday, July 22, 2011 11:58 AM
  • Why not create you own WMI name space?
    Friday, July 22, 2011 1:37 PM
  • Thanks Garth - great idea, and it is much cleaner this way

    step 1: script (run once as admin/system) to create custom wmi namespace under root, then give authenticated users modify rights to it

    step 2: script (run on a schedule as user) to populate the class info in the new namespace


    and of course make mof edits to pull the data... works like a champ.

    Thursday, July 28, 2011 5:36 PM
  • Where do I get a copy of the vbs script?
    Thursday, February 09, 2012 7:59 PM
  • Link no longer valid, do you have an updated one?
    Thursday, February 09, 2012 8:49 PM
  • Here is the new link.. you need to sign in to download them.

    Thursday, February 09, 2012 8:52 PM
  • drives not showing up in my hardware inventory, but after running script on client I see them in WMI.  I edited Mof file and restarted services, now what?
    Friday, February 10, 2012 4:19 PM
  • Has both Machine policies and HW inv run since editing the sms_def.mof?

    Friday, February 10, 2012 9:54 PM
  • Really its very interesting think like you write In that sms_def.mof file skip to the end, and paste in the mof edit for the drives piece of datashift.  Which, according to the Mini Monster Mof Builder.thanks for sharing the information.
    Saturday, February 11, 2012 3:44 AM
  • What if the user is not a local administrator? In my execmgr log it shows that the login script was succesful on the computer, but I don't have it as part of the hardware inventory.  Also, when it first ran, it waited until a user logged on to run (since I have it running as user context).  My other computers where the user is a local administrator reported fine with hardware inventory.  What could be the issue?
    Wednesday, February 15, 2012 5:11 PM
  • If your users are not administrators then you need to create a two-step process.

    1. Run a script to create an area where to place the data and grant permission to users allowing them to update it.
    2. Run the script as user and have it update the space created above.

    Thursday, February 16, 2012 12:20 AM
  • where is the data placed right now? directly in WMI?

    are you saying just place it in a file, say on the desktop? how would I do that with a separate script?

    I also read in the article that you can explicitly add the domain user group to CIMV2 using the MMC.

    Is that another way?

    Thursday, February 16, 2012 1:20 PM
  • Datashift put the data within WMI.

    I would not put the data on the desktop.. either in WMI or the Registry.

    Yes you need two scripts.

    Yes you can do that but... If I remember right that will give them rights to everything within that WMI class group but you still need two scripts to do this.

    Thursday, February 16, 2012 8:09 PM
  • I have it running "only when a user is logged on", running with user rights.  Now, should I set it to "run once for every user who logs on" as well?  Say you want it to query the mapped drives for whichever user happens to be logged on three weeks after the script first runs.  I'm guessing I'd need the script to re-run for every user so that it would re-run for this one who is now logged on?
    Thursday, February 16, 2012 8:32 PM
  • I would re-run it weekly...

    Thursday, February 16, 2012 10:59 PM
  • Anyone had issues with the datshift.vbs not working on 64 bit OS? I get a new class added on all the 32 bit machines for mapped drives, but none for 64.  Execmgr.log shows as the script successful so it runs fine from SCCM standpoint.  It just doesn't seem to have any effect on those OS...?
    Monday, February 27, 2012 6:38 PM
  • This should work… However check to see if you are running he 32bit cscript or the 64bit cscript.

    Monday, February 27, 2012 11:45 PM
  • My program runs cscript file.vbs, which you'd think would run from SYSWOW64 on 64 bit, anyway what do I do to run the "64 bit cscript"?
    Tuesday, February 28, 2012 1:06 PM
  • There are two versions cscript.exe, take a look at

    BTW, I just testing this on my Win7 Ws and it created the wmi class. so...

    Tuesday, February 28, 2012 10:29 PM
  • So it doesn't seem to be related to 64 bit, but I do have some machines (most 64 bit) that run the vbs successfully according to advertisement status, and have gone through a hardware inventory, yet don't have an additional class for mapped drives when I go to resource explorer.  Which log should I look in to find the issue?
    Tuesday, March 06, 2012 9:09 PM
  • this is a 3rd party script, I don't recall that there are any log files generated by the script.  so no logs to look at.  I guess look at wbemtest, (or whatever your favorite wmi browser is) and see if the namespace exists at all.

    Standardize. Simplify. Automate.

    Tuesday, March 06, 2012 9:32 PM
  • notice the datashift.vbs only adds the drive letter to WMI class but not the path, how can we add that to the script?

    EDIT: yes, it does, my fault

    • Edited by Matt MS Tuesday, March 06, 2012 9:57 PM
    Tuesday, March 06, 2012 9:49 PM
  • so I use wbemtest and see the SMX_Drives class and querys fine, however, I never see that in resource explorer so even though hardware inventory is running (b/c I see it on other using console resource explorer) there is an issue with a few of the computers reporting this in hardware inventory.  Where to do from there?
    Tuesday, March 06, 2012 9:56 PM
  • do you have Roger Zanders' Client Center?  if you pick on 1 specific box that isn't reporting, even though you see the data in WMI locally, and request that 1 box to run a "full hardware inventory"; and then wait, of course, for it to report up... does it appear then?

    Standardize. Simplify. Automate.

    Tuesday, March 06, 2012 10:09 PM
  • I have Ricks right click tools and used that to initiate hardware inventory, and same no class there
    Tuesday, March 06, 2012 10:10 PM
  • I don't use Rick's tools.  Does it specifically have FULL hardware inventory in there?  if not, then it's a delta.  I'm asking you to do a full.

    Otherwise, go here:  at the bottom, under sources, are a few links to different "how to troubleshoot" inventory.  Start working through those if the full hinv doesn't produce any good results.

    Standardize. Simplify. Automate.

    Tuesday, March 06, 2012 10:53 PM
  • I looked at them, it is successful running a hardware inventory, but will NOT pull the SMX_Drives class into sccm database for a few computers.  On these if I run a WMI browser, I see it there.  What could be the problem?
    Wednesday, March 07, 2012 1:54 PM

    It is unclear to me, did you force a full inventory to occur?

    Read this article, it was written for SMS 2003 but still applies.

    Make sure that you look to see that the class is listed within the inventory agent log.

    BTW You really should start your own thread.

    Wednesday, March 07, 2012 2:11 PM
  • It FINALLY showed up in resource explorer after doing about five right click hardware inventory. I thought the right click tools were full inventory.  When I'd go to resource explorer, workstation status, it would show that it just ran.  So I'm not sure.

    Wednesday, March 07, 2012 2:57 PM
  • So you are Good now then?

    Wednesday, March 07, 2012 3:05 PM