fabfisc
Content Type
Profiles
Forums
Events
Posts posted by fabfisc
-
-
Sonic, thanks but i don't understeand how can i use it.
My problem is that i have to find a method to make it wait until the first printer installation is finished.
Only after this process, the second installation must will start, and so on with the third installation (only after the second).
So, 'cause the creation of the port is not a problem (the three creations can run togheter, it will creates without any problem), i need a "install the first printer...DONE? well, run the second installation TILL the first is finished (or till i can see that the first printer exists, that it was created)...finished? ok can run...run the third installation TILL the second is finished (same procedure as the second)...finished? ok go on"
Ok? Hope i'm clear.
Thanks
0 -
I made this script.
Hope it helps someone like me who has the same problem.
' *************************************************************************************** '
' Nome routine: InstallRicohDriver
' ---------------------------------------------------------------------------------------
' Descrizione routine:
' La routine, esegue la creazione delle tre porte (192.168.42.203, 192.168.42.217
' e 192.168.42.244), dopo averne controllato l'eventuale esistenza; quindi procede
' con l'installazione dei driver e delle relative stampanti per i piani 1, 2 e 5.
'
' Piano 1 - IP 192.168.42.217
' Piano 2 - IP 192.168.42.244
' Piano 5 - IP 192.168.42.203
'
' - step1: controllo esistenza porte stampanti
' - step2: aggiunta porta ed installazione driver stampante
' - step3: impostazione stampante predefinita
' ---------------------------------------------------------------------------------------
' Created by Fiscella Fabrizio on 20/02/2007
' *************************************************************************************** '
'
' costanti contenenti i nomi delle stampanti
'
prnPiano1 = "RICOH Aficio 2035 PCL 6 - P1"
prnPiano2 = "RICOH Aficio 2035 PCL 6 - P2"
prnPiano5 = "RICOH Aficio 2035 PCL 6 - P5"
nomeStampante = "RICOH Aficio 2035 PCL 6"
'
' -------------------------------------------- '
' STEP 1 - controllo esistenza porte stampanti '
' -------------------------------------------- '
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPorts = objWMIService.ExecQuery _
("Select * from Win32_TCPIPPrinterPort")
' Inizializzo le variabili che memorizzeranno l'eventuale esistenza di alcune porte
flg217trovata = 0
flg244trovata = 0
flg203trovata = 0
Wscript.Echo "."
Wscript.Echo " CONTROLLO ESISTENZA PORTE"
Wscript.Echo "."
' Ciclo per reperire quali porte siano già esistenti
For Each objPort in colPorts
if objPort.Name = "IP_192.168.42.217" then
Wscript.Echo "TROVATA PORTA: IP_192.168.42.217"
flg217trovata = 1
stampantiGiaEsistenti=stampantiGiaEsistenti+1
elseif objPort.Name = "IP_192.168.42.244" then
Wscript.Echo "TROVATA PORTA: IP_192.168.42.244"
flg244trovata = 1
stampantiGiaEsistenti=stampantiGiaEsistenti+1
elseif objPort.Name = "IP_192.168.42.203" then
Wscript.Echo "TROVATA PORTA: IP_192.168.42.203"
flg203trovata = 1
stampantiGiaEsistenti=stampantiGiaEsistenti+1
end if
Next
if stampantiGiaEsistenti = 3 then
' tutte le stampanti sono gia' installate
Wscript.Echo "TUTTE LE STAMPANTI SONO GIA' INSTALLATE",0,"123"
else
' --------------------------------------------------------- '
' STEP 2 - aggiunta porta ed installazione driver stampante '
' --------------------------------------------------------- '
Set objShell = CreateObject("Wscript.Shell")
if flg217trovata <> 1 then
' ------- '
' PIANO 1 '
' ------- '
AddPort "IP_192.168.42.217","192.168.42.217"
Wscript.Echo "."
Wscript.Echo " AGGIUNTA PORTA 192.168.42.217"
Wscript.Echo "."
' installo driver e stampante
stringa = "rundll32 printui.dll,PrintUIEntry /if /b " + """" + prnPiano1 + """" + " /f ""%systemdrive%\drivers\printer\ricoh2035\oemsetup.inf"" /r ""IP_192.168.42.217"" /m " + """" + nomeStampante + """"
objShell.Run stringa
Wscript.Echo "."
Wscript.Echo " AGGIUNTA STAMPANTE RICOH AFICIO PCL 6 - P1"
Wscript.Echo "."
end if
if flg244trovata <> 1 then
' ------- '
' PIANO 2 '
' ------- '
AddPort "IP_192.168.42.244","192.168.42.244"
Wscript.Echo "."
Wscript.Echo " AGGIUNTA PORTA 192.168.42.244"
Wscript.Echo "."
' prima di installare la stampante del piano 2, controllo che sia
' già stata installata quella del piano 1
chkPrnExist("1")
stringa = "rundll32 printui.dll,PrintUIEntry /if /b " + """" + prnPiano2 + """" + " /f ""%systemdrive%\drivers\printer\ricoh2035\oemsetup.inf"" /r ""IP_192.168.42.244"" /m " + """" + nomeStampante + """"
objShell.Run stringa
Wscript.Echo "."
Wscript.Echo " AGGIUNTA STAMPANTE RICOH AFICIO PCL 6 - P2"
Wscript.Echo "."
end if
if flg203trovata <> 1 then
' ------- '
' PIANO 5 '
' ------- '
AddPort "IP_192.168.42.203","192.168.42.203"
Wscript.Echo "."
Wscript.Echo " AGGIUNTA PORTA 192.168.42.203"
Wscript.Echo "."
' prima di installare la stampante del piano 2, controllo che sia
' già stata installata quella del piano 1
chkPrnExist("2")
stringa = "rundll32 printui.dll,PrintUIEntry /if /b " + """" + prnPiano5 + """" + " /f ""%systemdrive%\drivers\printer\ricoh2035\oemsetup.inf"" /r ""IP_192.168.42.203"" /m " + """" + nomeStampante + """"
objShell.Run stringa
' prima di installare la stampante del piano 5, controllo che sia
' già stata installata quella del piano 2
chkPrnExist("5")
Wscript.Echo "."
Wscript.Echo " AGGIUNTA STAMPANTE RICOH AFICIO PCL 6 - P5"
Wscript.Echo "."
end if
end if
' ------------------------------------------- '
' STEP 3 - impostazione stampante predefinita '
' ------------------------------------------- '
pianoSelezionato = inputbox ("Digitare il piano nel quale si trova la stampante da settare come predefinita","Piano di appartenenza","1, 2 o 5")
' flag per gestione uscita dal loop successivo
pianoOk = 0
'
' ciclo finchè non si setta la stampante predefinita oppure si clicca su ANNULLA
'
do while pianoOk = 0
if trim(pianoSelezionato) = "" then
'msgbox "Nessun piano selezionato." & vbcrlf & _
'"Non è stata impostata la stampante predefinita", 0, "Inserisci piano"
'exit do
else
if isNumeric(pianoSelezionato) then
select case pianoSelezionato
case 1
' prima di impostare la stampante predefinita,
' mi accerto che sia stata correttamente creata
chkPrnExist("1")
' imposto la stampante predefinita
SetDefaultPrinter (prnPiano1)
'msgbox "Stampante selezionata: piano" & pianoSelezionato, 0, "Inserisci piano"
pianoOk = 1
case 2
' prima di impostare la stampante predefinita,
' mi accerto che sia stata correttamente creata
chkPrnExist("2")
' imposto la stampante predefinita
SetDefaultPrinter (prnPiano2)
'msgbox "Stampante selezionata: piano" & pianoSelezionato, 0, "Inserisci piano"
pianoOk = 1
case 5
' prima di impostare la stampante predefinita,
' mi accerto che sia stata correttamente creata
chkPrnExist("5")
' imposto la stampante predefinita
SetDefaultPrinter (prnPiano5)
'msgbox "Stampante selezionata: piano" & pianoSelezionato, 0, "Inserisci piano"
pianoOk = 1
case else
msgbox "Piano non corretto" & vbcrlf & _
"Scegliere tra i seguenti piani: 1, 2 o 5", 0, "Inserisci piano"
pianoSelezionato = inputbox ("Digitare il piano nel quale si trova la stampante da settare come predefinita","Piano di appartenenza","1, 2 o 5")
pianoOk = 0
end select
else
msgbox "Valore non valido!" & vbcrlf & _
"Scegliere tra i seguenti piani: 1, 2 o 5", 0, "Inserisci piano"
pianoSelezionato = inputbox ("Digitare il piano nel quale si trova la stampante da settare come predefinita","Piano di appartenenza","1, 2 o 5")
pianoOk = 0
end if
end if
loop
function chkPrnExist(piano)
' ******************************************
' Funzione per controllo esistenza stampante
' ******************************************
'
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'
' ciclo fino a quando non ho trovato la stampante richiesta
'
prnTrovata = 0
do while prnTrovata = 0
' in ciclo reperisco la lista aggiornata delle stampanti presenti
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objPrinter in colInstalledPrinters
' in ciclo reperisco la lista aggiornata delle stampanti presenti
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")
if IsLike(objPrinter.Name, "*ricoh*") = true then
if piano = 1 then
if IsLike(objPrinter.Name, "*P1*") = true then
prnTrovata = 1
end if
elseif piano = 2 then
if IsLike(objPrinter.Name, "*P2*") then
prnTrovata = 1
end if
elseif piano = 5 then
if IsLike(objPrinter.Name, "*P5*") then
prnTrovata = 1
end if
end if
end if
Next
loop
end function
Function IsLike(strText, match)
' *************************************************
' Funzione LIKE - per controllo esistenza stampante
' *************************************************
'
Dim i, str, spec, temp, token, nPos
' Turn strings to lower case
str = LCase(strText)
spec = LCase(match)
' Split the various components of the match string
aInput = split(spec, "*") ' "c*.*m" becomes Array("c", ".", "m")
' Walk the array of specification sub-components
i = 0
For Each token In aInput
' The first token plays an important role: the file name must begin
' with a substring identical to the token.
If i = 0 Then
temp = Left(str, Len(token))
' Don't match...
If temp <> token Then
IsLike = False
Exit Function
End If
' Removes the leading substring before next step
str = Right(str, Len(str) - Len(token))
Else
temp = str
' For each asterisk we come accross, we chack that what remains of
' the filename contains the next token of the match string.
nPos = Instr(1, temp, token)
' Don't match...
If nPos = 0 Then
IsLike = False
Exit Function
End If
' Removes the leading substring before next step
str = Right(str, Len(str) - nPos + 1)
End If
i = i + 1
Next
IsLike = True
End Function
function AddPort(nomePorta,indIp)
' -------------------------------------------------------------------------- '
' AGGIUNTA PORTA '
' ______________ '
' PARAMETRI: '
' nomePorta: nome della porta da creare (es.: "IP_192.168.42.217") '
' indIp : indirizzo della porta da creare (es.: "192.168.42.217") '
' '
' -------------------------------------------------------------------------- '
if nomePorta <>"" then
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = nomePorta
objNewPort.Protocol = 1
objNewPort.HostAddress = indIp
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
end if
end function
Function SetDefaultPrinter(prnDefault)
' *********************************************** '
' FUNZIONA PER IMPOSTARE LA STAMPANTE PREDEFINITA '
' *********************************************** '
'
Set WshNet = CreateObject("Wscript.Network")
WshNet.SetDefaultPrinter prnDefault
Set WshNet = Nothing
Wscript.Echo "."
Wscript.Echo " STAMPANTE PREDEFINITA: " + prnDefault
Wscript.Echo "."
end function
' *************************************************************************************** '
0 -
First of all tanks for your reply.
Well, i'm trying with a vbs and im coming out dearly.
Because, as i said first, there are 3 printers, i wrote 3 command to:
1) check if a port already exists;
2) for each NOT existing port, add it by using:
Set objWMIService = GetObject("winmgmts:")Set objNewPort = objWMIService.Get _("Win32_TCPIPPrinterPort").SpawnInstance_objNewPort.Name = "IP_192.168.42.xxx"objNewPort.Protocol = 1objNewPort.HostAddress = "192.168.42.xxx"objNewPort.PortNumber = "9100"objNewPort.SNMPEnabled = FalseobjNewPort.Put_3) use the follow line to add and install each printer:
rundll32 printui.dll,PrintUIEntry /if /b "RICOH Aficio 2035 PCL 6 - P1" /f "%systemdrive%\drivers\printer\ricoh2035\oemsetup.inf" /r "IP_192.168.42.xxx" /m "RICOH Aficio 2035 PCL 6"Now, ther's an arising problem. If the three printers are not yet installed on the pc, the vbs will do it, but too quickly so it can't add drivers for the second or the third printer 'cause it's busy installing for the first or for the first and second at the same time...
In other words, the code execute commands too nearest each other. Is there a method to wait some seconds between command lines? (like: wait 5 seconds? so it will be able to install completely the first, then the second and finally the third printer?)
Thanks againg.
P.S. if you want, i can post my code
0 -
Hi, i create a batch script which creates 3 ports, in my office lan "192.168.42.217" and 2 others, add printer drivers and creates 3 printers.
Now, if one of the three printers already exists, it creates anyway the printer name, with final " (1)" (without quotes).
I wish check if a port number already exists or a printer name exists and, using an IF command in a batch, bypass the line command which create the printer.
Can someone help me?
Thanks in advance
0
HP dv6520el sata driver (for XP obviously)
in Windows XP
Posted
Hi all, after surf the web for long time, i still didn't found a solution for my problem.
I have an HP dv6520el with Vista preinstalled, but i wish to install XP.
I read many topics (english, italian, french...) but no one solved it.
Who tells to download driver of previous series (60xx) then add the drivers with nlite, who tells to manually modify TXTSETUP.SYS and WINNT.SIF...and i tried, i tried but with no result!
I burned some cds hoping to let recognize the SATA hd, but nothing. Some errors and "press any key to restart". It's impossible even if i put drivers downloaded from intel into a pen drive, because the pen drive is not recognized !!! How can i do? I'm becoming crazy!
I have made an unattended installation cd of XP for my office workstations, and it runs very well , but i still can't for my 6520el.
Is there anyone with the same problem?...and who solved it?
Hope someone here can help me.
Many thanks
Fabrizio