Winbatch RunElevated strange behaviour ?

Antworten
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Winbatch RunElevated strange behaviour ?

Beitrag von nicolaslebrun »

Hi,

I got this piece of winst code to install printer driver on Win10...

Code: Alles auswählen

Message "Installation des drivers par WinBatch"
UpdateEnvironment
WinBatch_pnputil_10 /RunElevated 

[WinBatch_pnputil_10]
%system%\PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install 
I can't understand the logs... because PNPUtil.exe does exist.
I tried wihtout UpdateEnvironment, or without %system% it's the same.

Code: Alles auswählen

[5] [sept. 25 22:42:04:409] [recia-printer-driver-install]       message Installation des drivers par WinBatch
[5] [sept. 25 22:42:04:413] [recia-printer-driver-install]       Execution of: WinBatch_pnputil_10 /RunElevated
[5] [sept. 25 22:42:04:413] [recia-printer-driver-install]       
[4] [sept. 25 22:42:04:413] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:04:825] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:05:230] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:05:634] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:06:037] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:06:442] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:06:847] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:07:252] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:07:656] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:08:060] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe -retrying
[4] [sept. 25 22:42:08:465] [recia-printer-driver-install]         Warning: file not found :C:\Windows\system32\PNPUtil.exe - giving up
[6] [sept. 25 22:42:08:465] [recia-printer-driver-install]         Call "C:\Windows\system32\PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install"
[6] [sept. 25 22:42:08:466] [recia-printer-driver-install]            Waiting until the called process is finished
[6] [sept. 25 22:42:08:466] [recia-printer-driver-install]         Start process elevated ....
[3] [sept. 25 22:42:08:473] [recia-printer-driver-install]         C:\Windows\system32\PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install .... CreateProcessAsUser Error 2 (Le fichier spécifié est introuvable.)
[3] [sept. 25 22:42:08:473] [recia-printer-driver-install]         Error: C:\Windows\system32\PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install .... CreateProcessAsUser Error 2 (Le fichier spécifié est introuvable.)

The same line " C:\Windows\system32\PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install " does work in a terminal command (event launch as system with psexec).

Any idea ?

Regards,
Nico
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1354
Registriert: 01 Jul 2008, 12:10

Re: Winbatch RunElevated strange behaviour ?

Beitrag von wolfbardo »



OPSICONF 2024
https://opsi.org/en/opsiconf/

opsi-Basisworkshops:

22. - 25. 04. 2024


opsi support - uib gmbh
For productive opsi installations we recommend maintainance + support contracts which are the base of opsi development.

http://www.uib.de
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Winbatch RunElevated strange behaviour ?

Beitrag von nicolaslebrun »

Thanks Bardo for your answer...

I initially add the version above

Code: Alles auswählen

Message "Installation des drivers par WinBatch"
UpdateEnvironment
WinBatch_pnputil_10 /RunElevated /Sysnative

[WinBatch_pnputil_10]
PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install 
When I add /Sysnative (with or without %system% as i suppose c:\windows\system32 is in PATH ), the opsi-script remains stuck ( i have to remove setup and reboot !!! )....

I should have posted this version first.
The same line does work properly

Code: Alles auswählen

PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install 
Regards,
Nicolas
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Winbatch RunElevated strange behaviour ?

Beitrag von nicolaslebrun »

And

Code: Alles auswählen

Message "Installation des drivers par WinBatch"
DosBatch_pnputil_10 WINST /Sysnative /Showoutput

[DosBatch_pnputil_10]
%system%\PNPUtil.exe /add-driver c:\drv-imp\*.inf /subdirs /install 
remains stuck too... despite the same line is OK in cmd or powershell...

What am I missing ?

Regards
Nico
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Re: Winbatch RunElevated strange behaviour ?

Beitrag von SisterOfMercy »

nicolaslebrun hat geschrieben:What am I missing ?
I'm not sure if PNPutil can handle a wildcard. I have this in a script:

Code: Alles auswählen

[Winbatch_install_drivers_64]
"%SystemRoot%\system32\forfiles.exe" /P "$InstallDir64$" /S /M *.inf /C "cmd.exe /c PnPutil.exe -a @Path"
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Winbatch RunElevated strange behaviour ?

Beitrag von nicolaslebrun »

Thanks, SisterOfMercy,
I'm not sure if PNPutil can handle a wildcard.
In Win10, it does work.

I have some new behaviours with winst 4.1+ I hadn't with 4.0.7, but i'm not able to understand why...

Regards,
Nico
Benutzeravatar
ThomasT
uib-Team
Beiträge: 529
Registriert: 26 Jun 2013, 12:26

Re: Winbatch RunElevated strange behaviour ?

Beitrag von ThomasT »

Could it be a 32bit/64bit issue?
Take a look at the end of Section 9.12
Kein Support per DM!
_________________________
opsi support - https://www.uib.de/
For productive opsi installations we recommend support contracts.
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: Winbatch RunElevated strange behaviour ?

Beitrag von nicolaslebrun »

Hi Thomas,

I think it was Bardo's suggest after my first post.

There was a mistake in my original post, but I always launch in /Sysnative and the %system% should not differ...

It's just as if the System Account does not access anymore to some Environment Variables, some paths ...

Is there a place to see the "complete' winst changelog ?

Thks,
Nico
Antworten