作業目標:
使用AD的情況下,想要讓使用者登入時,自動鏈結網路磁碟機與自動更新通訊錄
做法:
登入時會呼叫設定檔NETWORK.VBS,切除網路磁碟>>鏈結網路磁碟>>執行.BAT檔更新通訊錄。
除特定人員單獨鏈結特別的磁碟機,多數人只須連基本的4個。
(正確)下方設定中在WIN7,都可以正確執行,開機以後自動切斷網路磁碟機、自動連結磁碟機、自動更新通訊錄
(問題)在WIN10,此VBS就不會執行,所以通訊錄也不會更新。
小弟編程底子淺,請各位幫忙看看,謝謝
在AD的使用者帳戶>>設定檔>>登入指令檔,放入以下路徑 C:\Windows\SYSVOL\domain\scripts\NETWORK.vbs
###NETWORK.VBS設定如下###
Dim WSHNetwork
Dim objSh
Dim User
Dim CRLF
Dim ComputerName
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set objSh = WScript.CreateObject("WScript.Shell")
ComputerName=Ucase(wshnetwork.ComputerName)
do while ComputerName=""
WScript.Sleep 500
ComputerName=Ucase(wshnetwork.ComputerName)
loop
User=Ucase(wshnetwork.username)
do while User=""
WScript.Sleep 500
User=Ucase(wshnetwork.username)
loop
'WSHNetwork.RemoveNetworkDrive "I:"
objSh.Run "NET USE * /DELETE /YES " , 1
WScript.Sleep 2000
SELECT CASE UCASE(ComputerName)
CASE "PF-GUIDEVELOP" 'AAA
WSHNetwork.MapNetworkDrive "X:", "\SERVER2\Source"
WSHNetwork.MapNetworkDrive "P:", "\PF-GUIDEVELOP\FAX"
WSHNetwork.MapNetworkDrive "Z:", "\vmware-host\Shared Folders"
CASE "PF2019051501" 'BBB
WSHNetwork.MapNetworkDrive "P:", "\\server1\efax"
WSHNetwork.MapNetworkDrive "V:", "\\server1\gilink"
WSHNetwork.MapNetworkDrive "S:", "\\server2\scan"
WSHNetwork.MapNetworkDrive "Y:", "\\server2\共用目錄"
WSHNetwork.MapNetworkDrive "X:", "\\SERVER2\Source"
CASE ELSE
WSHNetwork.MapNetworkDrive "P:", "\\server1\efax"
WSHNetwork.MapNetworkDrive "V:", "\\server1\gilink"
WSHNetwork.MapNetworkDrive "S:", "\\server2\scan"
WSHNetwork.MapNetworkDrive "Y:", "\\server2\共用目錄"
END SELECT
WScript.Sleep 2000
objSh.Run "自動(60)更新通訊錄.bat"
###通訊錄.BAT寫法如下###
MD C:\OUTLOOK
XCOPY \SERVER2\共用目錄\共用文件區\資訊\OutLook\XXX.pst C:\OUTLOOK /C /Y
PAUSE
將 ad上的顯示名稱 "王xx" 改成 "資訊-王xx"
就可以讓用戶使用LDAP來查詢最新最正確的通訊錄
不需要 exchange 喔!
試試看結果啦!
參考:https://ithelp.ithome.com.tw/questions/10155361