Niro
(Fresh Scripter)
2008-02-13 07:29 PM
get mapped drives

I'm trying to create a script to get all the mapped drives on all our machines...I can get all the machine names using the newview2 function (and run through it using a for loop)...but how would I get the drive mappings on the machines?

It would look something like this:

for each $computer in netview2("domain")
$drives = getmappeddrives
if open(4, "c:\drives.txt",5)=0
writeline(4, $drives + " " + $computer)
EndIf
next


Thanks!
-Mike


NTDOCAdministrator
(KiX Master)
2008-02-13 09:53 PM
Re: get mapped drives

There are pre-coded UDFs that can do that for you already.

UDF Forum



Niro
(Fresh Scripter)
2008-02-13 09:59 PM
Re: get mapped drives

I see one that will get it for the local machine, but not remote machines. I guess it would need to get the mapped drives for the currently logged on user since they're profile based...

Richard H.Administrator
(KiX Supporter)
2008-02-14 09:59 AM
Re: get mapped drives

You can read the "\\{computer}}\HKEY_USERS\{sid}\Network" key to find drive mappings.

Depending on what you are trying to do you may get away with enumerating all the SIDs - otherwise you will need to identify which one you are interested in.


Witto
(MM club member)
2008-02-14 11:58 AM
Re: get mapped drives

To get the SID, maybe you cold use GetSid() or one of the Name2Sid() functions at http://www.kixtart.org/udf/