Announcement

Collapse
No announcement yet.

WSH Login script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WSH Login script

    This my current script It checks for users in different printer groups and maps printers. Due to recent changes instead of mapping based on users I now have to map printers based on computers.. Is there a simple way to change UserObj to get computernames string and not Userstring???


    In short map printers based on what computers are in the different groups?
    -------------------------------------------------------



    Set WSHShell = CreateObject("WScript.Shell")
    Set WSHNetwork = CreateObject("WScript.Network")

    Set objDomain = getObject("LDAP://rootDse")
    DomainString = objDomain.Get("dnsHostName")
    UserString = WSHNetwork.UserName
    Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)


    For Each GroupObj In UserObj.Groups
    Select Case GroupObj.Name
    'Check for group memberships and take needed action
    Case "printer560"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\560",True
    Case "printer360color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\360color",True
    Case "printer415color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\415color",True
    Case "printer460color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\460color",True
    Case "printer555color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\555color",True
    Case "printer527color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\527color",True
    Case "printer446color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\446color",True
    Case "printer480color"
    WSHNetwork.AddWindowsPrinterConnection "\\tigger\480color",True
    End Select
    Next
Working...
X