Powershell Failing to register inf files

Hello all; I’m creating a very simple script as part of OSD - handles driver injection. It runs flawlessly from the powershell console, but bigfix is failing & I can’t figure it out. Do you see anything obvious or have any suggestions?

Get-ChildItem "C:\drivers" -Recurse -Filter “*.inf” | ForEach-Object { PNPUtil.exe -i -a $_.FullName}

It’s probably using the 32-bit Powershell.exe. Before launching the powershell, try adding

action uses wow64 redirection false
to your action script

No love w/ the wow64 redirection; switched it up and tried using a batch now getting error 255. Usually don’t have issues running CMD files in BF. Do you guys see anything wrong w/ it? Batch runs fine in cmd prompt; no joy in BF.

cd c:\drivers\

for /f “tokens=*” %a in (‘dir *.inf /b /s’) do (%WinDir%\system32\pnputil –i -a “%a..*.inf”) 2>&1 >> %WinDir%\system32\driverimport.log

When you say the batch file works fine, did you actually create a .bat / .cmd and run it, or just type the commands individually in the shell? When you put it in a .bat / .cmd, you have to double-up the percent symbols in the FOR statement it

for /f %%i in ()
Otherwise it looks ok to me

I ran each individually; worked, wrapped in a batch and shipped w/ bf & didn’t work - error 255. I’m sure I’m doing something wrong w/ the syntax. I appreciate the help!

This works :grinning: thx again for your help

waithidden powershell.exe -ExecutionPolicy bypass -command “Get-ChildItem C:\drivers\ -Recurse -Filter “*.inf” | ForEach-Object {{PNPUtil.exe -i -a $_.FullName}”

action may require restart