|
|
|||||||
Hello, Just starting to test out the use of "ADDPRINTERCONNECTION" for the first time. What I'm seeing is on the windows 7 computers, while the printer connection is adding successfully, it's also setting the printer as the default. It's hard to search on these forums / the internet for people with similar issues because pretty much all of the results are people WANTING to set the default printer, where as I do not want to. Any ideas? tia p.s. The same script running on windows xp works as expected. It just adds the additional connection and doesn't change the original default printer (what we want). |
||||||||
|
|
|||||||
This is the first I have heard of this. However, if the user had no printers, and you add a printer, then I would expect it to be the default. Can you post your script? |
||||||||
|
|
|||||||
Code: ADDPRINTERCONNECTION ("\\hi2\hifacultycopier") ADDPRINTERCONNECTION ("\\hi2\hiofficecopier") That's it. Of course I have other stuff that I run, but as a test I made a script that is that and only that. Now I will say that while I haven't been able to replicate the problem on XP at all (it always works as expected on XP), it DOES work as expected on my own machine Windows 7 machine (UAC off though) (adds the printer without changing the default). However, on 2 different clients that I've tested so far (both Windows 7 pro 64-bit with UAC turned ON, both same model computer built from same image, but in different domains) it changes the default. And actually I just noticed while I was typing this that the default was changed to the faculty copier, which is the first line in the script. So that's weird. I'll play around with the order and see if there is any difference. |
||||||||
|
|
|||||||
So I modified the script to this: Code: ;FROM http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=118766 function GetDefaultPrinter() $GetDefaultPrinter = join(split(readvalue("HKEY_USERS\"+@sid+"\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),',',1),'') endfunction $a = GetDefaultPrinter $r1 = ADDPRINTERCONNECTION ("\\hi2\hifacultycopier") $b = GetDefaultPrinter $r2 = ADDPRINTERCONNECTION ("\\hi2\hiofficecopier") $c = GetDefaultPrinter OPEN (1, '%USERPROFILE%' + '\test.txt', 5) WRITELINE (1, $a + @CRLF) WRITELINE (1, $r1 + @CRLF) WRITELINE (1, $b + @CRLF) WRITELINE (1, $r2 + @CRLF) WRITELINE (1, $c + @CRLF) CLOSE (1) And this is the output: Code: RM 206 Mono 0\\hi2\HI Faculty Copier 0\\hi2\HI Faculty Copier Yet if I run the same exact script on my machine: Code: Technology Color 0Technology Color 0Technology Color EDIT: Switching the order switches which one gets set to the default. So whichever the first one is is getting set as the default. So it seems to me that for whatever reason maybe it doesn't think a default printer is set and is therefor setting it? EDIT2: same result if I run the script from a command line (instead of via logon script) |
||||||||
|
|
|||||||
Try this just to see if what you think is happening, is really happening. Code: if ADDPRINTERCONNECTION("\\hi2\hifacultycopier")=0 "Printer Added" else "Printer Not Added - " + @serror endif I know nothing about your environment, but keep in mind that you have to have both the 32 and 64 bit printer drivers installed on your printer server, and those drivers have to be identical in name and version. |
||||||||
|
|
|||||||
Originally Posted By: Allen I know nothing about your environment, but keep in mind that you have to have both the 32 and 64 bit printer drivers installed on your printer server, and those drivers have to be identical in name and version. I know the script is adding the printers and the drivers and I'm sure the driver (64bit) is on the server. These clients never had these printers (network copiers) that I'm adding, nor any other printer of the same model and I'm removing the printers after the script runs every time while testing it. |
||||||||
|
|
|||||||
Had the same issue. See: http://www.kixtart.org/forums/ubbthreads...true#Post198009 Fixed it by adding printers, check if the correct printer is default and setting it as default if it is not default yet/anymore. |
||||||||
|
|
|||||||
http://windows.microsoft.com/is-IS/windo...-work-or-school http://social.technet.microsoft.com/Foru...3-8dda96dcdded/ just some thoughts. |
||||||||
|
|
|||||||
So I modified the script to this to fix it: Code: ;FROM http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=118766 function GetDefaultPrinter() $GetDefaultPrinter = join(split(readvalue("HKEY_USERS\"+@sid+"\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),',',1),'') endfunction $dp1 = GetDefaultPrinter $r = ADDPRINTERCONNECTION ("\\hi2\hiofficecopier") $r = ADDPRINTERCONNECTION ("\\hi2\hifacultycopier") $dp2 = GetDefaultPrinter IF NOT $dp1 = $dp2 $r = SETDEFAULTPRINTER($dp1) ENDIF Kind of a hack, but it works. edit: edited to include UDF for completeness. |
||||||||
|
|
|||||||
Interesting.... I've never come across this problem. Also interesting is the first link Lonk linked to, talks about clicking on "Manage Default Printers" button. I don't have that button at all on my desktop. Another site suggest disabling the change with reg hack... writevalue("hkcu\Printers\Defaults","Disabled",1,"REG_DWORD") http://www.normanbauer.com/2011/03/11/how-to-disable-windows-7s-default-printer-management/ |
||||||||
|
|
|||||||
Two generalized and simplified snippet from our logon script. These two sections exist for all our network printers. We have it all AD group based and we have extensive logging in the script. Groups are generalized and the logging has been removed in the examples below. The printer server gets set earlier in the script and (to keep things nice and simple) the printer name and the share name are the same. We use the PriMapState UDF to check if the printer is already installed and if it is already default or not. Mapping a printer: Code: ;Map printer Printer001 ;Check group membership. If InGroup("Printer001-Default") Or InGroup("Printer001-Extra") ;Set printer name. $printer = "\\" + $printerserver + "\Printer001" ;Check if the printer is already installed. If Not PriMapState($printer) ;Printer is not installed. Add printer. ;Add entry to text log file $rc = AddPrinterConnection($printer) EndIf EndIf Setting a default printer: Code: ;Set default printer Printer001 ;Check group membership. If InGroup("Printer001-Extra") $printer = "\\" + $printerserver + "\Printer001" ;Check if the printer is already set as default. If PriMapState($printer) <> "2" ;Set default printer. $rc = SetDefaultPrinter($printer) EndIf EndIf |
||||||||
|
|
|||||||
Allen, I think it is one of them features. I've not seen this before either |
||||||||
|
|
|||||||
What version of Kix are you using? I only ask because wan't there changes to the printer portions in the newest release? |
||||||||
|
|
|||||||
FYI - Our Universal Login Script evaluates which of several printers could/should be the default, then as printers are mapped, explicitly sets that one as default. Glenn |
||||||||
|
|
|||||||
Originally Posted By: ShaneEP What version of Kix are you using? I only ask because wan't there changes to the printer portions in the newest release? "KiXtart 2010 4.62" |