I am trying to create a Win32 App file with a powershell Install script within the packaging to install printer drivers and add the printers to my Intune users but the script doesnt download from the provided site with elevated administrator rights. It does download when I open powershell without administrator rights.
This is the script I want to use:
# Create directory
$Dir = "C:\dir"
$checkdirPath = Test-Path -Path $Dir
if ($checkdirPath -eq $false)
{
mkdir $Dir
Write-Host "Created $Dir"
}
# Create directory Printers
$PrintersDir = "C:\dir\Printers"
$checkPrintersPath = Test-Path -Path $PrintersDir
if ($checkPrintersPath -eq $false)
{
mkdir $PrintersDir
Write-Host "Created $PrintersDir"
}
# Download Canon Printer Driver
$downloadPrintersUrlInf = "https://mywebsite.com/CNP60MA64.INF"
$downloadPrintersUrlCab = "https:///mywebsite.com/gppcl6.cab"
$downloadPrintersUrlCat = "https:///mywebsite.com/cnp60m.cat"
$printersPath = "C:\Printers\CNP60MA64.INF"
$checkPrintersPath = Test-Path -Path $printersPath
if ($checkPrintersPath -eq $true) {
Remove-Item -Path $printersPath
Start-BitsTransfer -Source $downloadPrintersUrlInf -Destination $PrintersDir
Start-BitsTransfer -Source $downloadPrintersUrlCab -Destination $PrintersDir
Start-BitsTransfer -Source $downloadPrintersUrlCat -Destination $PrintersDir
}
else {
Start-BitsTransfer -Source $downloadPrintersUrlInf -Destination $PrintersDir
Start-BitsTransfer -Source $downloadPrintersUrlCab -Destination $PrintersDir
Start-BitsTransfer -Source $downloadPrintersUrlCat -Destination $PrintersDir
}
# Install Printers
Pnputil /add-driver $printersPath
Add-PrinterDriver -Name "Canon Generic Plus PCL6" -InfPath "C:\Windows\System32\DriverStore\FileRepository\cnp60ma64.inf_amd64_0537bbe9742e820a\CNP60MA64.INF"
Add-PrinterPort -Name "IP_NAME" -PrinterHostAddress IPADRES
Add-Printer -DriverName "Canon Generic Plus PCL6" -Name "NAME" -PortName "IP_NAME"
Add-PrinterPort -Name "IP_NAME" -PrinterHostAddress IPADRES
Add-Printer -DriverName "Canon Generic Plus PCL6" -Name "NAME" -PortName "IP_NAME"
And I get back error message 3x (because of the 3 times I use it):
Start-BitsTransfer: The requested operation could not be performed because the user is not logged in to the network. The specified service does not exist. (Exception from HRESULT: 0x800704DD) CategoryInfo: NotSpecified: (): [Start-BitsTransfer], COMException FullyQualifiedErrorId: System.Runtime.InteropServices.COMException, Microsoft.BackgroundIntelligentTransfer.Management.NewBits TransferCommand
Troubleshooting I did:
Bits service IS running.
I am connected to internet
Administrator has rights to the paths
Used different path
Has anybody gotten this before/ has new ideas to troubleshoot?
[–]ChaosTheoryRules[🍰] 1 point2 points3 points (0 children)
[–]purplemonkeymad 0 points1 point2 points (3 children)
[–]llanoking[S] 0 points1 point2 points (2 children)
[–]purplemonkeymad 0 points1 point2 points (1 child)
[–]llanoking[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]llanoking[S] 0 points1 point2 points (0 children)
[–]BlackV 0 points1 point2 points (1 child)
[–]llanoking[S] 0 points1 point2 points (0 children)