|
|
|||||||
Hello People I have a big Problem with the Printmigration I have 150 Printers and now i will change my Printserver. The old Printer's call homeprinter1, homeprinter2...The new nameconversation is now printer1, printer2.... So i have make a Script: ------------------------------------------------------- If DelPrinterConnection ("\\server1\homeprinter1") = 0 AddPrinterConnection ("\\server4\printer1") EndIf . . . . . ------------------------------------------------------- That's function good, but the the loginscript using a long time to running because they are so much printers... Have you got anothter solution??? It's very important for me. best regards wk2x PS: Thank you for your help |
||||||||
|
|
|||||||
you should use either a enumConnectedPrinters() or loop via all of the possible printers with isPrinterConnected() hmm... I think the easier would be the first choice. damn, actually, I see that there is only wsh dependant udf's on that section can you give an example of a value in: HKEY_CURRENT_USER\Printers\Connections asking this cause I don't currently have access to any network nor networked printers to write the script for you |
||||||||
|
|
|||||||
Here is a function that I use to remap printers... Code:
|
||||||||
|
|
|||||||
yes, i can. HKEY_CURRENT_USER -> Connections > ,,server1,homeprinter1 and in this Section are Server with the Value \\server1 |
||||||||
|
|
|||||||
Thank you for your help, but when i testing your script.... they Printers aren't make anything |
||||||||
|
|
|||||||
hmm... if you wanna move all printers from one server to another call the above function with the servernames and change this line: Code:
to: Code:
|
||||||||
|
|
|||||||
ohhh, no i think you understand me false. I have a 2 Printservers an old and a new. The Old Printers are all again installed on the new Server. But the Client's use still the old Server. So i need a script for the clients that running fast and add the printer they are installed on the clients again. Naturally from the new Server with the new naming convention. Do you know what i mean? |
||||||||
|
|
|||||||
The PriMapState should be all that you need.. PriMapState() - Checks for existent printerconnection We have used it many times with printers being moved around to other servers and it works great! Kent |
||||||||
|
|
|||||||
hmmm..interesting... have you got an example from a move script...sorry, i don't understanding this script... |
||||||||
|
|
|||||||
Right here in the EXAMPLES forum is an example. Move Printer Server http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=118702 This came from a post that started here. Take the time to read the post and you should see how easy it is to change the clients to a new print server. Prevent special printers from being deleted http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB1&Number=37277 |
||||||||
|
|
|||||||
noooooooo! wk2x, I understood you 100%. you just didn't get me. you need to add the given code to your logonscript and it does exactly what you asked. and, like I already said in the beginning, primapstate() is no option for you. it's too complex and requires you to write some code too. the above solution is ready made for you. oh, and doc, the noooooooo! is not a reply to you. |
||||||||
|
|
|||||||
actually, the delprinterconnection and addprinterconnection lines need changing too but the code itself works just fine and is a fit for your situation. |
||||||||
|
|
|||||||
now, i'am confused.. ----------------------------------------------- $sOldPath = "\\server1" $sNewPath = "\\server4" Function fnRemapPrinter($sOldPath,$sNewPath) Dim $i,$nul,$sPorts,$sDefault,$sPrinters[25] If @INWIN=1 $sPorts="HKCU\Printers\Connections\" $sDefault=Split(ReadValue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),",")[0] Do $sPrinters[$i]=EnumKey($sPorts,$i) $i=$i+1 If Ubound($sPrinters)=$i Redim Preserve $sPrinters[Ubound($sPrinters)+25] EndIf Until @ERROR Redim Preserve $sPrinters[$i-1] For $i = 0 to Ubound($sPrinters) If Join(Split($sPrinters[$i],","),"\") = $sOldPath $nul = DelPrinterConnection($sOldPath) $nul = AddPrinterConnection($sNewPath) If $sDefault = $sOldPath $nul = SetDefaultPrinter($sNewPath) EndIf EndIf Next EndIf Exit @ERROR EndFunction --------------------------------------- What i make false? thank you for your help |
||||||||
|
|
|||||||
You failed to use the function. It is merely defined but nowhere is it called to action. |
||||||||
|
|
|||||||
How i use this Script, when the old servername is server1 and the new server4 and the printer change from homeprinter1,homeprinter2... to printer1, printer2...? Thank you for your HELP |
||||||||
|
|
|||||||
just do: fnRemapPrinter("server1","server4") anyways, like said, you need to change these lines too: Code:
to something like: Code:
|
||||||||
|
|
|||||||
------------------------------- Function fnRemapPrinter("server1","server4") Dim $i,$nul,$sPorts,$sDefault,$sPrinters[25] If @INWIN=1 $sPorts="HKCU\Printers\Connections\" $sDefault=Split(ReadValue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),",")[0] Do $sPrinters[$i]=EnumKey($sPorts,$i) $i=$i+1 If Ubound($sPrinters)=$i Redim Preserve $sPrinters[Ubound($sPrinters)+25] EndIf Until @ERROR Redim Preserve $sPrinters[$i-1] For $i = 0 to Ubound($sPrinters) $share=Split($sPrinters[$i],",") $share=$share[ubound($share)] $nul = DelPrinterConnection("\\server1\"+$share) $nul = AddPrinterConnection("\\server4\"+$share) If $sDefault = $sOldPath $nul = SetDefaultPrinter($sNewPath) EndIf EndIf Next EndIf Exit @ERROR EndFunction ------------------------------------- what i make false????....it doesn't work |
||||||||
|
|
|||||||
The function I posted above works at the printer level so an example of using it would look like... Code:
Here is one that remaps printers that just move to a different server, but retain the same printer share name... Code:
It will remap any printer the user has installed that is pointed to the old print server and remap it to the new print server. It will also work with 9x client, but they require a reboot whereas NT-based systems do not require a reboot. |
||||||||
|
|
|||||||
Also, from the sample you posted it would appear that you do not understand how to use User Defined Functions (UDFs). Please read the FAQ on How to use UDFs. |
||||||||
|
|
|||||||
yes, he forgot the use line I gave him. and the modified script he has, works on server level which is lot more effiecent in his case. |
||||||||
|
|
|||||||
Still don't see why a little hand holding and using your PriMapState() UDF wouldn't work here. Worked amazingly fast and accurate for me when I used it. I even wrote the basic structure for another Business Unit from International Support and it worked great for them too. |
||||||||
|
|
|||||||
it will work. I just don't see the reason to use it. if you are looking for printers attached via some server, checking for each printer separately does overheat. instead, going directly to the reg and checking all the mapped printers and moving all as needed is lot easier and no-maintenance-overheat approach. |