|
|
|||||||
Has worked flawlessly on 2000 and XP. It does not run on Windows 7. Code: ;********** Beginning of printer mapping ********* call @ScriptDir+'\PriMapState.udf' $WS = GetObject('WinNT://' + @domain + '/' + @wksta + '$$') if @error ? @serror else $ps1='prn01' $ps2='prn02' $ps3='prn03' $ps4='prn04' $ps5='prn05' for each $grp In $WS.Groups $GrpName = $grp.Name ;--- Add additional printers --- if left($GrpName,2) = 'A0' ; $psn = substr($Grpname,2,2) ;print server number determined by 2-3 characters A01=PS1 if $psn='01' $ps=$ps1 endif if $psn='02' $ps=$ps2 endif if $psn='03' $ps=$ps3 endif if $psn='04' $ps=$ps4 endif if $psn='05' $ps=$ps5 endif $addlprinter = substr($GrpName,5) ;printer group name starts at 5th character Ex. Group D01_q-mis or A01_q-mis $addlprinter = $ps+'\'+$addlprinter $addlprinter = '\\'+$addlprinter ? "Additional Printer: "$addlprinter if not PriMapState($addlprinter) ? "Status: Printer not connected " + $addlprinter $nul=AddPrinterConnection($addlprinter) ? "Status: Printer added " + $addlprinter ? @serror endif endif ;--- Add and set default printer --- if left($GrpName,2) = 'D0' ;print server number determined by third character D01=PS1 D02=PS2 $defprinter = substr($GrpName,5) ;printer group name starts at 5th character $psn = substr($Grpname,2,2) if $psn='01' $ps=$ps1 endif if $psn='02' $ps=$ps2 endif if $psn='03' $ps=$ps3 endif if $psn='04' $ps=$ps4 endif if $psn='05' $ps=$ps5 endif $defprinter = $ps+'\'+$defprinter $defprinter = '\\'+$defprinter ? "** Printers assigned through Printer Setup Group **" ? " " ? "Default Printer: "$defprinter if not PriMapState($defprinter) ? "Status: Printer not connected "+$defprinter $nul=AddPrinterConnection($defprinter) ? "Status: Printer added "+ $defprinter ? @serror $nul=SetDefaultPrinter($defprinter) ? "Status: Default Printer set "+ $defprinter ? @serror endif if PriMapState($defprinter)<>2 $nul=SetDefaultPrinter($defprinter) ? "Status: Default Printer changed "+ $defprinter ? @serror endif endif next endif |
||||||||
|
|
|||||||
If this is a GPO Startup Script... see the following thread for ideas. http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=198514#Post198514 If not, post back. |
||||||||
|
|
|||||||
This is not a gpo startup script. I call it from kix.bat on the user profile settings tab. Thanks! |
||||||||
|
|
|||||||
Forgot to mention, that I am testing it by manually running it from a command prompt. Works fine on XP, just not Windows 7. Drives are mapped, but printers based upon ComputerInGroup are not mapped. |
||||||||
|
|
|||||||
Are the Win7 pcs 64bit? If so, you have to have the 64bit drivers installed on the server as well. |
||||||||
|
|
|||||||
Also, what is the @serror returned after the addprinterconnection() line. |
||||||||
|
|
|||||||
No error gets returned. |
||||||||
|
|
|||||||
Yes, 64-bit Windows 7. |
||||||||
|
|
|||||||
64-bit kix drivers? Separate download from the 4.62 download? Printers work if you install them manually on the Windows 7 machines. The 64 bit print drivers do exist on the print servers. It is only the kix script that fails to install the printers. Drive mappings and other scripts work, just not printer mappings. Perhaps this is the reason. |
||||||||
|
|
|||||||
It appears as only Domain Local group membership is retrieved, not global. I did see there was a hotfix from Microsoft, but I could not install it on the Windows 7 PC. http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=196497 |
||||||||
|
|
|||||||
Code: $WS = GetObject('WinNT://' + @domain + '/' + @wksta + '$$') if @error ? @serror else for each $grp In $WS.Groups $GrpName = $grp.Name ? "Workstation groups: "$grp.Name endif This returns only Domain Local groups: Workstation groups: Domain Computers Workstation groups: Printer Setup DL Group My PC is a member of the following Global Groups: Printer Setup Group (must be in group to call printer setup script) A04_q-mis1 (printer group) D04_q-mis2 (printer group) Do I need to change my printer setup groups to be Domain Local Groups to get Windows 7 pcs to obtain printers via Kix? |
||||||||
|
|
|||||||
Lets start simple first. Please run this and give us your results... Code: If addprinterconnection("your printer")=0 ? "Printer Added" else ? "Printer Not Added" ? @serror endif |
||||||||
|
|
|||||||
The hotfix was only for Win 7 PCs with a Windows 2000 Domain Controler, and was included in SP1 for Windows 7. |
||||||||
|
|
|||||||
I was referring to 64bit print drivers. There is no kix64 yet. |
||||||||
|
|
|||||||
Printer Added |
||||||||
|
|
|||||||
You could be on to something... the NT provider might not be working as expected. Try using GetADUserGroups (it uses LDAP) and see if you get better results. The example in the header should be enough to find out if it gets better results.... GetADUserGroups() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=198609#Post198609 How to use UDFs - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943 The rest of the UDFs are here - http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1 |
||||||||
|
|
|||||||
Changing the D04_q-mis2 Global Group to a Domain Local Group DOES work. Workstation groups: Domain Computers Workstation groups: D04_q-mis2 Workstation groups: Printer Setup DL Group ** Printers assigned through Printer Setup Group ** Default Printer: \\prn03\q-mis2 |
||||||||
|
|
|||||||
Curious though... how come you chose to do it this way instead of just using the built in INGROUP? Code: if Ingroup("blah") $rc=addprinterconnection("printer") endif |
||||||||
|
|
|||||||
I need to map based upon Computer Group membership. I did not think Ingroup worked for Computers, only users. I work at a hospital where the users move from floor to floor often. The printer must be physically close to the computer, not the user. |
||||||||
|
|
|||||||
There is also... Computeringroup() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=195717#Post195717 |
||||||||
|
|
|||||||
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=46049&fpart=3 |
||||||||
|
|
|||||||
Your link is broke... |
||||||||
|
|
|||||||
I am using ComputerInGroup to call the script that does the mapping. Code: if ComputerInGroup('Printer Setup Group')=1 call @ScriptDir+'\printers.kix' endif How do I use ComputerInGroup to enumerate all of the computer's group membership in my script? http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=46049&fpart=1 |
||||||||
|
|
|||||||
I'm headed out... Maybe someone else can hop in here... |
||||||||
|
|
|||||||
May have found something to try. http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=201892 |
||||||||
|
|
|||||||
Same problem with EnumComputerinGroups. Only enumerates Domain Local groups on Windows 7. |
||||||||
|
|
|||||||
You mind running a test vb script? Got it from this sight, which describes some potential errors encountered when using the memberof function, which is what EnumComputerInGroups and ComputerInGroup uses. http://www.rlmueller.net/MemberOf.htm Not sure if it's helpful, but it's something. Code: Set objSysInfo = CreateObject("ADSystemInfo") strUserDN = objSysInfo.computername Set objUser = GetObject("LDAP://" & strUserDN) On Error Resume Next arrGroups = objUser.GetEx("memberOf") If (Err.Number <> 0) Then On Error GoTo 0 Wscript.Echo "Member of no groups" Else On Error GoTo 0 For Each strGroup In arrGroups Wscript.Echo "Member of group " & strGroup Next End If |
||||||||
|
|
|||||||
ShaneEP: Results of script: ERROR : IDispatch pointers not allowed in expressions! Script: X:\test.KIX Line : 2 |
||||||||
|
|
|||||||
Oops. Not a kix script. Running it as a vb yields the domain local groups only. |
||||||||
|
|
|||||||
Well atleast we know its not a kix issue. Have your tried using WinNT instead of LDAP? |
||||||||
|
|
|||||||
Windows XP returns all groups, domain local and global. |
||||||||
|
|
|||||||
This is what I am using: Code: $WS = GetObject('WinNT://' + @domain + '/' + @wksta + '$$') for each $grp In $WS.Groups $GrpName = $grp.Name |
||||||||
|
|
|||||||
Oh yeah, sorry I missed that on the first page. It just doesn't make much sense to me that it worked on XP and not Win7. I'm assuming nothing changed on the server side? |
||||||||
|
|
|||||||
The script has not changed. Two pcs with same group membership. XP results: Workstation groups: ITS Computers Workstation groups: Automatic Updates Computers Workstation groups: Domain Computers Workstation groups: Printer Setup Group Workstation groups: A04_q-mis1 Workstation groups: Windows Updates Computers Workstation groups: Printer Setup DL Group Workstation groups: D04_q-mis2 Windows 7 results: (these are all Domain Local groups) Workstation groups: Domain Computers Workstation groups: D04_q-mis2 Workstation groups: Printer Setup DL Group |
||||||||
|
|
|||||||
I have not tested this, so there could be an bug or few. Try it out see what you get. |
||||||||
|
|
|||||||
Thank you, Allen. I am home today fighting a crappy cold. I will test this on Monday and let you know results. |
||||||||
|
|
|||||||
On XP with Server 2003 AD this comes back empty for me Allen |
||||||||
|
|
|||||||
Just to be sure, you have the computer (not user) in some groups? |
||||||||
|
|
|||||||
Ah.. didn't even think about that Allen you're probably right. I may not have any stations in groups at this time. I did have at one point but think I've since removed them. If I have time I'll add some and test it again. Thanks |
||||||||
|
|
|||||||
GetADComputerGroups on Win7 only retrieves Domain Local Groups too. |
||||||||
|
|
|||||||
I don't know if this is the same thing or not... but here is something I found for your reading pleasure. http://networkadminkb.com/KB/a9/group-enumeration-between-trusted-domains-does-not.aspx |
||||||||
|
|
|||||||
Thank you. Looks like I will be changing group types. |
||||||||
|
|
|||||||
Reading that article indicates not all Domain Local groups are enumerated. My groups are Global groups. Changing my Global to Domain Local allows the script to run. The article suggests using Universal groups, not Domain Local. |