Forum Discussion
ABill1
Oct 12, 2023Iron Contributor
deploying printer via intune
Hello everyone, I'm in need of assistance with the following script I'm currently using: powershell # Replace the placeholders with your details $inf_path = ".\driver\KOBxxK__01.inf" $drive...
- Oct 16, 2023Seems ok if you copy all the files in a folder on a test machine (Or Windows Sandbox) and run install.cmd as Administrator... Does that work?
Philn88
Copper Contributor
Thanks, will take a look at SysNative info.
The PS script containing C:\Windows\SysNative\pnputil.exe /add-driver "$psscriptroot\Drivers\eSf6u.inf" /install
works when running it manually but not through Intune. I guess when Win32 calls pnputil.exe it redirects to SysWOW64 where it does not exist.
Is there another way to add the printer driver into the Windows Driver store without using pnputil.exe?
The PS script containing C:\Windows\SysNative\pnputil.exe /add-driver "$psscriptroot\Drivers\eSf6u.inf" /install
works when running it manually but not through Intune. I guess when Win32 calls pnputil.exe it redirects to SysWOW64 where it does not exist.
Is there another way to add the printer driver into the Windows Driver store without using pnputil.exe?
Oct 24, 2023
I use it in my script (See my blog post link above) like this where I try all the pnputil paths 😉
#Add all printer drivers by scanning for the .inf files and installing them using pnputil.exe
$infs = Get-ChildItem -Path . -Filter "*.inf" -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Fullname
$totalnumberofinfs = $infs.Count
$currentnumber = 1
Write-Host ("[Install printer driver(s)]`n") -ForegroundColor Green
Foreach ($inf in $infs) {
Write-Host ("[{0}/{1}] Adding inf file {2}" -f $currentnumber, $totalnumberofinfs, $inf) -ForegroundColor Green
try {
c:\windows\sysnative\Pnputil.exe /a $inf | Out-Null
}
catch {
try {
c:\windows\system32\Pnputil.exe /a $inf | Out-Null
}
catch {
C:\Windows\SysWOW64\pnputil.exe /a $inf | Out-Null
}
}
$currentnumber++
}
#Add all printer drivers by scanning for the .inf files and installing them using pnputil.exe
$infs = Get-ChildItem -Path . -Filter "*.inf" -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Fullname
$totalnumberofinfs = $infs.Count
$currentnumber = 1
Write-Host ("[Install printer driver(s)]`n") -ForegroundColor Green
Foreach ($inf in $infs) {
Write-Host ("[{0}/{1}] Adding inf file {2}" -f $currentnumber, $totalnumberofinfs, $inf) -ForegroundColor Green
try {
c:\windows\sysnative\Pnputil.exe /a $inf | Out-Null
}
catch {
try {
c:\windows\system32\Pnputil.exe /a $inf | Out-Null
}
catch {
C:\Windows\SysWOW64\pnputil.exe /a $inf | Out-Null
}
}
$currentnumber++
}