arşiv

‘VBScript’ kategorisi için arşiv

Vb script – MapNetworkDrive

Cuma, 19 Oca 2018 yorum yok
Option Explicit

Dim objNetwork, objFSO, objShell

Dim strDriveLetter, bForce, bUpdateProfile, strNewName
strDriveLetter = "Z:"
bForce = "True"
bUpdateProfile = "True"
strNewName = "\\bıdıbıdı\folder"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")

If (objFSO.DriveExists(strDriveLetter) = True) Then
objNetwork.RemoveNetworkDrive strDriveLetter, True, True
End If
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strNewName

Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName

' Wscript.Echo "Check : "& strDriveLetter & " for " & strNewName
WScript.Quit

 

Categories: VBScript Tags: