#143996 - 2005-07-21 02:54 AM
ComputerInGroup() Working on XP, not on 2000
|
Skip
Fresh Scripter
Registered: 2005-07-01
Posts: 41
|
Your help is greatly appreciated. This is my 3rd time posting here, first on this subject and so far have had great success. If I have posted to the incorrect board, please remove or delete. I am a NOOB, but I am really trying hard to get this.
I want to map printers to map for any user that sits sits down at a PC. So, I created 6 or 7 Universal Security Groups and placed each of our PC's into one of these groups. No PC is in 2 groups. We are a child Domain in a Multi-Domain Forest. Domain name is PHI. Howard and Radimus' UDF is working well on the XP Pro PC's, but I can not get it to work on the 2000 boxes. Below is both the mapprinters.kix script and the UDF, being used.
The W2k boxes I have been testing are members of the "ph_prt_medical_area" group. Our AD environment is all 2003 server. I am not sure if I need to edit the UDF or not. If I do, could someone assist in correct syntax?
The printers are not getting installed at all on the 2000 PC's. There are no printers installed on the PC's at all. I can successfully install and set the default printers via KixTart without using the UDF, but that won't work due to PC and printer locations.
Thanks again for your help. mapprinters.kix Code:
Break ON CLS
If @PRODUCTSUITE & 16 RETURN; If this is a terminal server does not execute EndIf If @PRODUCTTYPE = "Windows Server 2003" or @PRODUCTTYPE = "Windows Server 2003 Domain Controller" or @PRODUCTTYPE = "Windows Server 2000" or @PRODUCTTYPE = "Windows Server 2000 Domain Controller" RETURN EndIf
Dim $UDFPATH $UDFPATH = "\\phi2\netlogon" CALL $UDFPATH+"\Computeringroup.udf" ;CALL $UDFPATH+"\GetDefaultPrinter.udf" ; Product Types will have to be added for additional operating systems If @PRODUCTTYPE = "Windows NT Workstation" Or @PRODUCTTYPE = "Windows 2000 Professional" Or @PRODUCTTYPE = "Windows XP Professional"
;Find out what the Default Printer is $PrinterKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" $PrinterVal = "Device" $TempString = READVALUE ($PrinterKey, $PrinterVal)
;The Printername is the first part of the registry value $x = INSTR($TempString,",") $DefaultPrinter = SUBSTR($TempString,1,$x-1)
If ComputerInGroup('phlax_prt_lafra')=1 If $DefaultPrinter = "\\philaxsrv01\HP LaserJet 5Si MX" RETURN ELSE AddPrinterConnection("\\philaxsrv01\laser1") ? "Added printer connection...." If SetDefaultPrinter("\\philaxsrv01\HP LaserJet 5Si MX") ? "Default printer was set to \\philaxsrv01\laser1" RETURN EndIf EndIf EndIf
If ComputerInGroup('ph_prt_confroom_area')=1 If $DefaultPrinter = "\\phi2\SAVIN 2545/2245 RPCS" RETURN ELSE AddPrinterConnection ("\\phi2\copier2") = 0 ? "Added printer connection...." If SetDefaultPrinter ("\\phi2\SAVIN 2545/2245 RPCS") = 0 ? "Default printer was set to \\phi2\copier2, Outside Conference Room BLDG 1" RETURN EndIf EndIf EndIf If ComputerInGroup('ph_prt_stoploss_area')=1 If $DefaultPrinter = "\\phi2\HP LaserJet 4000 Series PCL 6 #2 on PHI2" RETURN ELSE AddPrinterConnection("\\phi2\hp4000-2") AddPrinterConnection("\\phi2\copier2") ? "Added printer connection...." If SetDefaultPrinter("\\phi2\HP LaserJet 4000 Series PCL 6 #2 on PHI2") = 0 ? "Default printer was set to \\phi2\hp4000-2, by the Kitchen Area in BLDG 1" RETURN EndIf EndIf EndIf If ComputerInGroup('ph_prt_medical_area')=1 If $DefaultPrinter = "\\phi2\HP LaserJet 4000 Series PCL6" RETURN Else AddPrinterConnection("\\phi2\hp4000-1") AddPrinterConnection("\\phi2\copier1") ? "Added printer connection...." If SetDefaultPrinter("\\phi2\HP LaserJet 4000 Series PCL6") = 0 ? "Default printer was set to \\phi2\hp4000-1, In the Medical Claims Area, BLDG 1" RETURN EndIf EndIf EndIf If ComputerInGroup('ph_prt_medical_area2')=1 If $DefaultPrinter = "\\phi2\Gestetner 3235e PCL 6" RETURN ELSE AddPrinterConnection("\\phi2\hp4000-1") AddPrinterConnection("\\phi2\copier1") ? "Added printer connection...." If SetDefaultPrinter("\\phi2\Gestetner 3235e PCL 6") = 0 ? "Default printer was set to \\phi2\Copier3, In the File Room, BLDG 1" RETURN EndIf EndIf EndIf
If ComputerInGroup('ph_prt_dental_area')=1 If $DefaultPrinter = "\\phi2\Gestetner 3502 PCL 6" RETURN ELSE AddPrinterConnection("\\phi2\copier3") AddPrinterConnection("\\phi2\hp4100-1") ? "Added printer connection...." If SetDefaultPrinter("\\phi2\Gestetner 3502 PCL 6") ? "Default printer was set to \\phi2\copier3, BLDG 2" RETURN EndIf EndIf EndIf If ComputerInGroup('ph_prt_enr_area')=1 If $DefaultPrinter = "\\phi2\HP LaserJet 4100 PCL 6" RETURN ELSE AddPrinterConnection("\\phi2\hp4100") AddPrinterConnection("\\phi2\copier3") ? "Added printer connection...." If SetDefaultPrinter("\\phi2\HP LaserJet 4100 PCL 6") ? "Default printer was set to \\phi2\hp4100, BLDG 2" RETURN EndIf EndIf EndIf
If ComputerInGroup('ph_prt_itdept_area')=1 If $DefaultPrinter = "\\phi2\HP LaserJet 4050 Series PCL 6" RETURN ELSE AddPrinterConnection("\\phi2\hp4050-1") AddPrinterConnection("\\phi2\copier2") ? "Added printer connection...." If SetDefaultPrinter("\\phi2\HP LaserJet 4050 Series PCL 6") ? "Default printer was set to \\phi2\hp4050-1" RETURN EndIf EndIf EndIf RETURN
Computeringroup.udf Code:
Function ComputerInGroup($group,optional $Domain) Dim $oGrp if not $domain $domain=@domain endif $oGrp = GetObject("WinNT://" + $domain + "/" + $group + ",group" ) if @error exit 1 endif if $oGrp.IsMember("WinNT://" + $domain + "/" + @wksta + "$$" ) $ComputerInGroup=1 else $ComputerInGroup=0 endif endfunction
_________________________
-sphilip
|
|
Top
|
|
|
|
ComputerInGroup() Working on XP, not on 2000
|
Skip
|
2005-07-21 02:54 AM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Skip
|
2005-07-21 04:34 AM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Skip
|
2005-07-21 05:24 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Howard Bullock
|
2005-07-22 01:17 AM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Chris S.
|
2005-07-22 03:40 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Chris S.
|
2005-07-22 04:06 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
maciep
|
2005-07-22 05:13 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Chris S.
|
2005-07-22 05:36 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
maciep
|
2005-07-22 06:01 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Les
|
2005-07-22 07:03 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Chris S.
|
2005-07-22 07:16 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Les
|
2005-07-22 07:23 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Skip
|
2005-07-22 07:46 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
Chris S.
|
2005-07-22 07:53 PM
|
Re: ComputerInGroup() Working on XP, not on 2000
|
NTDOC
|
2005-07-21 05:30 PM
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 989 anonymous users online.
|
|
|