日期:2014-05-17  浏览次数:20889 次

求WINDOW SERVER 2008 登陆脚本
小弟不才,想请各位大大给个域用户登录新电脑时自动根据组别来添加打印机和共享文件夹脚本.望各位大大帮忙下.

小弟写了一个VBS,但就是不能用.请各位指点.

Const CS_GROUP     = "cn=CS_Group"
Const FIN_GROUP         = "cn=Fin_Group"
Const TRN_GROUP = "cn=TRN_Group"
Const ECO_Group = "cn=ECO_Group"
Const WHS_Group = "cn=WHS_Group"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "X:",
"\\SPFILE03\Dept-Share\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, CS_Group) Then

    wshNetwork.MapNetworkDrive "X:",
    "\\SPFILE03\Dept-Share\"
    wshNetwork.MapNetworkDrive "Y:",
    "\\Spfile03\mb gc"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\MY-GC-CS-PRT01"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\MY-GC-CS-PRT02"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\RICOH Aficio 2022 PCL 6"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\MY-GC-CS-PRT03"
    wshNetWork.SetDefaultPrinter
    "\\Spprint02\RICOH Aficio 2022 PCL 6"

ElseIf InStr(strGroups, HR_GROUP) Then

    wshNetwork.MapNetworkDrive "X:",
    "\\SPFILE03\Dept-Share\"
    wshNetwork.MapNetworkDrive "Y:",
    "\\Spfile03\mb gc"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\EPSON LQ-2190 ESCP2"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\RICOH Aficio MP C2051 PCL 6"
    wshNetWork.SetDefaultPrinter
    "\\Spprint02\RICOH Aficio MP C2051 PCL 6"

ElseIf InStr(strGroups, TRN_GROUP) Then

    wshNetwork.MapNetworkDrive "X:",
    "\\SPFILE03\Dept-Share\"
    wshNetwork.MapNetworkDrive "Y:",
    "\\Spfile03\mb gc"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\RICOH Aficio MP 2352 PCL 6"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\MY-GC-TRN-PRT01"
    wshNetWork.SetDefaultPrinter
    "\\Spprint02\RICOH Aficio MP 2352 PCL 6"

ElseIf InStr(strGroups, WHS_GROUP) Then

    wshNetwork.MapNetworkDrive "X:",
    "\\SPFILE03\Dept-Share\"
    wshNetwork.MapNetworkDrive "Y:",
    "\\Spfile03\mb gc"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint02\MY-DC-WHS-PRT01"
    wshNetwork.AddWindowsPrinterConnection
    "\\Spprint0