Win NT – Logon Script Network MAP

Script semplice e veloce per mappare le unita’ di rete nei domini active directory, c’e’ chi usa ancora il “net use” ma purtroppo hanno anche inventato il VBS:

Notare che la terza mappatura mappa la home prendendo come variabili dallo username.
Nominare .vbs

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3
Dim strUserName, strDriveLetter1, strDriveLetter2, strDriveLetter3

strDriveLetter1 = "S:"
strDriveLetter2 = "P:"
strDriveLetter3 = "X:"

strRemotePath1 = "\\server\share"
strRemotePath2 = "\\server\driver"
strRemotePath3 = "\\server"

Set objNetwork = CreateObject("WScript.Network")

objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2

Set objNetwork = WScript.CreateObject("WScript.Network")
strUserName = objNetwork.UserName
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3 _
& "\" & strUserName & "$"

Wscript.Quit

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.