Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script installs printers but not based on Group HELP!!

Status
Not open for further replies.

nootgevallen

Technical User
May 22, 2003
81
0
0
NL
I have printer groups in windows 2003
My workstation is added to the group Print-Systeembeheer

But my workstation gets printers vg01 and vg02 and i am not in that group! ??

Can someone see what i do wrong.


script :

Const Systeembeheer = "cn=Print-Systeembeheer"
Const Vastgoed = "cn=print-vastgoed"

Set wshNetwork = CreateObject("WScript.Network")

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

If InStr(strGroups, Systeembeheer_GROUP) Then


wshNetwork.AddWindowsPrinterConnection "\\SRV-EXCHANGE-1\VG01"
wshNetwork.AddWindowsPrinterConnection "\\SRV-EXCHANGE-1\VG02"
wshNetWork.SetDefaultPrinter "\\SRV-EXCHANGE-1\VG02"

ElseIf InStr(strGroups, Vastgoed) Then

wshNetwork.AddWindowsPrinterConnection "\\SRV-EXCHANGE-1\VG02"
wshNetWork.SetDefaultPrinter "\\SRV-EXCHANGE-1\VG02"

End If
 
Hello nootgevallen,

First, this may be just a typo.
[tt]
If InStr(strGroups, Systeembeheer[red]_GROUP[/red]) Then
[/tt]
Second, you have to make Systeembeheer all in lcase(), one way or the others. So, if you want to keep the const declaration, do this?
[tt]
If InStr(strGroups, lcase(Systeembeheer)) Then[/tt]

regards - tsuji
 

It works!! based on username , What do i have to change to install it based on Workstation group membership?

 
i have found it myself just replace username with computername
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top