Advertisement
Advertisement
| 05.20.2008 at 01:41PM PDT, ID: 23418775 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: |
Const PrinterA ="cn=PrinterA"
Const PrinterB = "cn=PrinterB"
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
If InStr(strGroups, PrinterA) Then
wshNetwork.AddWindowsPrinterConnection "\\W2k8-INT\PrinterA"
wshNetwork.AddWindowsPrinterConnection "\\W2k8-INT\PrinterB"
wshNetWork.SetDefaultPrinter "\\W2k8-INT\PrinterA"
ElseIf InStr(strGroups, PrinterB) Then
wshNetwork.AddWindowsPrinterConnection "\\W2k8-INT\PrinterB"
wshNetwork.AddWindowsPrinterConnection "\\W2k8-INT\PrinterA"
wshNetWork.SetDefaultPrinter "\\W2k8-INT\PrinterB"
End If
|