Я полностью пересмотрел свой ответ после просмотра других сценариев, которые делают то же, что вы хотите достичь, принимая во внимание intune.
Пожалуйста, попробуйте ниже:
# This script installs the US Bizhub C368 printer # This checks to see if the printer has already been added $CheckPrinter = Get-printer | where {$_.Name -like "US Bizhub C368"} If ($CheckPrinter -eq $null) { # Make IT folder for driver download $ITFolder = "C:\IT" New-Item -Path $ITFolder -ItemType Directory # Download the driver from Azure Blob repository $source = "OurAzureBlobURL.com" $zipdestination = "$ITFolder\USBizhubC368Driver.zip" Invoke-WebRequest $source -OutFile $zipdestination # Extract the zip archive and delete the zip $unzippeddestination = "$ITFolder\USBizhubC368Driver" Expand-Archive -Path $zipdestination -DestinationPath $unzippeddestination Remove-Item -Path $zipdestination if($env:PROCESSOR_ARCHITECTURE -eq "x86"){ Start-Process "$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -WorkingDirectory $ITFolder -ArgumentList "pnputil /add-driver *.inf /subdirs /install | Out-File -FilePath (Join-Path $ITFolder '\Install-Drivers.txt')" -NoNewWindow -Wait } elseif($env:PROCESSOR_ARCHITECTURE -eq "AMD64"){ Start-Process "powershell.exe" -WorkingDirectory $ITFolder -ArgumentList "pnputil /add-driver *.inf /subdirs /install | Out-File -FilePath (Join-Path $ITFolder '\Install-Drivers.txt')" -NoNewWindow -Wait } [String]$pnpOutput = Get-Content "$ITFolder\Install-Drivers.txt" | Select-String "Published Name" $pnpOutput -match "Published name:\s*(?<name>.*\.inf)" $driverINF = Get-ChildItem -Path C:\Windows\INF\$($matches.Name) Add-PrinterDriver -Name "KONICA MINOLTA C368SeriesPCL" -InfPath $driverINF.FullName Add-PrinterPort -Name "US Bizhub C368" -PrinterHostAddress "192.168.121.20" Add-Printer -Name "US Bizhub C368" -DriverName "KONICA MINOLTA C368SeriesPCL" -PortName "US Bizhub C368" }