ฉันกำลังพยายามซ่อนเส้นทางเครือข่ายของโฟลเดอร์ที่แชร์จากผู้ใช้โดเมน (Windows Server 2012) ฉันพบสคริปต์นี้ขณะค้นหาป้ายกำกับไดรฟ์เครือข่าย:
Option Explicit
Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName
strDriveLetter = "H:"
strRemotePath = "\\servername\sharedfoldername$\"
strNewName = "Save Your Files Here"
'Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
'Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
WScript.Echo "Check : "& strDriveLetter & " for " & strNewName
WScript.Quit
เส้นทางเครือข่ายของฉันจะเป็นดังนี้:
strRemotePath = "\\servername\sharedfoldername1$\%username%"
strRemotePath = "\\servername\sharedfoldername2$\%username%"
strRemotePath = "\\servername\sharedfoldername5$\%username%"
strRemotePath = "\\servername\sharedfoldernameNNN$\%username%"
เมื่อฉันใส่ %username%
สคริปต์จะไม่ทำงาน
กรุณาแนะนำฉันถึงวิธีการแก้ไขสคริปต์นี้ที่จะทำงานตามความต้องการของฉัน