vbs script to achieve network drive mapping and labeling changes

vbs script to achieve network drive mapping and labeling changes, completely independent research and development, unique, find useful point of a friend save:

Set WshNetwork = CreateObject("WScript.Network")
set wshshell = wscript.createObject("WScript.shell")
dim mypath
mypath = "\xxx.domain.com\" //共享文件路径
if WshNetwork.UserName = "aaaa" then
elseif WshNetwork.UserName = "bbbb" then
WshNetwork.MapNetworkDrive "M:", mypath & WshNetwork.UserName
WshNetwork.MapNetworkDrive "O:", mypath & "wl_information_dept"
WshNetwork.MapNetworkDrive "V:", mypath & "video"
WshNetwork.MapNetworkDrive "P:", mypath & "photo"
//当用户名为bbbb时映射四个网盘
elseif WshNetwork.UserName = "cccc" then
else
end if
wscript.sleep 1000

strNewName = "My"
strDriveLetter = "M:"
Set objShell = CreateObject("shell.application")
if isNull(objShell.NameSpace(strDriveLetter)) then
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
end if
strNewName = "DeptPublic"
strDriveLetter = "O:"
Set objShell = CreateObject("shell.application")
if isNull(objShell.NameSpace(strDriveLetter)) then
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
end if
strNewName = "Photo"
strDriveLetter = "P:"
Set objShell = CreateObject("shell.application")
if isNull(objShell.NameSpace(strDriveLetter)) then
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
end if
= strNewName "Video"
strDriveLetter = "V:"
the Set objShell = CreateObject ( "of the Shell.Application")
IF isNull (objShell.NameSpace (strDriveLetter)) the then
objShell.NameSpace (strDriveLetter) .Self.Name = strNewName
End IF
\ achieve four a network disk label changes, effectively hiding the actual path network disk to protect the security of the server.

Guess you like

Origin blog.51cto.com/77jiayuan/2463912