Question Locked

Scripting Help

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Good afternoon.

Is there a way I can tell which users have what mapped drivers and also which mapped drives are available please?

Let me give you some background on this....

Im trying to create a new shared area across departments, however we have so many drive mappings and cross mappings via departments im just wondering if theres a script or an easier way to tell which drivers are free.

Many thanks.

3 replies

by swatts

The best way would be to organize your scripts. If you are using the new GP edit snapin you can easily see what policies are being applied for user groups and find out what scripts are running then go thru the scripts and clean them up.

Brute force is to go to the workstatoin and type net use from the cmd prompt.

by faradhi

Mostly it depends on your choice of scripting languages. Below are two examples one command line batch file the other a vbscript.

in a batch file, you would use a series of If Exists

IF NOT EXIST E:\ NET USE E: \\UNC && GOTO END
IF NOT EXIST F:\ NET USE F: \\UNC && GOTO END
...
:END

You would continue with a IF NOT EXIST statement until you have one for each drive letter you want to use.

with VBScript it is a little easier in some ways.

Dim objFilSys, objNet

Set objFilSys = CreateObject("Scripting.FileSystemObject")
Set objNet = CreateObject("WScript.Network")

'enter all the possible drive letters here.
arrDrives = Array("E:", "F:", "G:", ...)

mapDrive "\\UNCPATH"

Sub mapDrive (strUNC)
For Each i in arrDrives
If Not objFilSys.DriveExists(i) Then
objNet.MapNetworkDrive i,strUNC
exit sub
End If
Next
wscript.echo "There are no drives available"
End Sub

Of course this will work for a temporary solution. However, you will want a more comprehensive solution that includes a consistent mapping scheme that is group related.

I recommend developing a consistent scheme and using the login scripts that delete the drive mappings that do not fit the scheme and then mapping drives according to the new scheme. Further, I suggest consolidating drive mappings whenever possible.

Hope this helps.

This discussion is closed to new replies.