#173806 - 2007-02-09 05:14 PM
Re: Script won't run at login, but runs from the command line
[Re: Witto]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Just a thought, I do not know if it would be tricky, but maybe you can enumerate all the ShareName keys under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers and save them to a text file to avoid typo errors...
;************************************************************************* ; Script Name: CreatePrinterList.kix ; Author: Wim Rotty ; Date: 9/02/2007 ; Description: List all printer sharenames on printer server ;*************************************************************************
;Script Options If NOT @LOGONMODE Break On Else Break Off EndIf DIM $RC $RC = SetOption("Explicit","On") $RC = SetOption("NoVarsInStrings","On") $RC = SetOption("NoMacrosInStrings","On") $RC = SetOption("WrapAtEOL","On")
;Redirect Screen Output to file $RC = RedirectOutput(@SCRIPTDIR+"\printers.txt")
;Declare vars DIM $RKyLocalPrinters, $SharedPrinters, $Printer, $i, $Separator $RKyLocalPrinters = "\\PRTSERVER\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers" $Separator = "," $i = 0
;Enumerate all local printers on server $Printer = EnumKey($RKyLocalPrinters, $i) While NOT @ERROR If NOT $SharedPrinters = "" $SharedPrinters = $SharedPrinters + $Separator EndIf ;Find ShareName and add it to list $SharedPrinters = $SharedPrinters + ReadValue($RKyLocalPrinters+"\"+$Printer+"\DsSpooler","printShareName") $i = $i + 1 $Printer = EnumKey($RKyLocalPrinters, $i) Loop $SharedPrinters ? |
This will save you a list named printers.txt in your scripting directory.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1183 anonymous users online.
|
|
|