Bài đăng

Đang hiển thị bài đăng từ tháng 5 11, 2008

Login Script extention in Using in Active Directory Environments

FileName: Logon.vbs Option Explicit Dim strComputer, strDrive, strPath, strUser, strPassword, strLabel Dim objNetwork, objShell Dim CheckDrive, AlreadyConnected, intDrive, boolPersistent 'Set objNetwork = WScript.CreateObject("WScript.Network") Set objShell = CreateObject("WScript.Shell") Set objNetwork = CreateObject("WScript.Network") Set CheckDrive = objNetwork.EnumNetworkDrives() strComputer = objNetwork.ComputerName strDrive = "X:" strUser = objNetwork.UserName strPath = "\\server\E$\Report\" & strUser strPassword = "" boolPersistent = false strLabel = strUser & " On Server" ' This section deals with a For ... Next loop ' See how it compares the enumerated drive letters ' with strDriveLetter On Error Resume Next AlreadyConnected = False For intDrive = 0 To CheckDrive.Count - 1 Step 2 If CheckDrive.Item(intDrive) = strDrive Then AlreadyConnected =True Next If Al...

Login Script in Using in Active Directory Environments

Tested by me filename:logon.vbs strComputer = "." strDrive = "X:" strLabel = "Disk On Server" strPath = "\\server\E$\Report" strUser = "" strPassword = "" boolPersistent = True strNewName = "Disk On Server" set objNetwork = WScript.CreateObject("WScript.Network") objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent Set objShell = CreateObject("Shell.Application") objShell.NameSpace(strDrive).Self.Name = strNewName Wscript.Echo "Login OK" WScript.Quit extention: check exist disk? Yes: no create No: new create after changing volume disk