none
第4个共享盘经常出不来,通过组策略,用户开机登陆运行脚本,代码如下: RRS feed

  • 问题

  • On Error Resume Next
    Set objNetwork = WScript.CreateObject("WScript.Network")
    Set colDrives = objNetwork.EnumNetworkDrives
    For i = 0 to colDrives.Count - 1 Step 2
    objNetwork.RemoveNetworkDrive colDrives.Item(i), true, true
    Next
    Set objNetwork = Nothing

    WScript.Sleep 5000

    dim netdrive,myuser
    set netdrive = CreateObject("wscript.network")
    myuser=netdrive.username 
    netdrive.MapNetworkDrive "M:","\\XXXX\" & myuser
    WScript.Sleep 500
    netdrive.MapNetworkDrive "O:","\\XXXX"
    WScript.Sleep 500
    netdrive.MapNetworkDrive "P:","\\XXXX"
    WScript.Sleep 500
    netdrive.MapNetworkDrive "Z:","\\XXXX"
    set netdrive=nothing
    set myuser=nothing

    dim netrename
    set netrename = CreateObject("Shell.Application")
    netrename.NameSpace("M:").Self.Name = "个人盘"
    netrename.NameSpace("O:").Self.Name = "部门盘"
    netrename.NameSpace("P:").Self.Name = "报表盘"
    netrename.NameSpace("Z:").Self.Name = "公告栏"
    set netrename=nothing
    2018年2月24日 0:38