02-23-2023 04:20 PM - edited 02-23-2023 04:22 PM
Last night I asked ChatGPT to write me a PowerShell Script to install a printer from an installer in my Dropbox tenant. This was what it gave me:
# Define the URL of the print driver file in Dropbox
$driverURL = "https://www.dropbox.com/s/example/exampledriver.inf?dl=1"
# Define the path where the driver should be downloaded and installed
$driverPath = "C:\PrinterDrivers"
# Create the driver directory if it does not already exist
if (!(Test-Path $driverPath)) {
New-Item -ItemType Directory -Path $driverPath
}
# Download the driver from Dropbox
Invoke-WebRequest -Uri $driverURL -OutFile "$driverPath\exampledriver.inf"
# Install the driver
$installResult = pnputil.exe /add-driver "$driverPath\exampledriver.inf" /install
# Check if the installation was successful
if ($installResult -eq "The driver package was successfully installed.") {
Write-Host "Driver installed successfully."
} else {
Write-Host "Driver installation failed: $installResult"
}
The output from the JumpCloud commands console was "0", meaning, it worked. I'll verify that in Windows shortly.
03-20-2024 01:42 AM
What are some common troubleshooting steps if the PowerShell script fails to install the printer correctly?
03-20-2024 02:45 PM
Kathlyn,
I wrote this one as an experiment when generative AI was new. Rather than troubleshoot: JumpCloud's app repository can deploy MSI packages and some drivers are available in the Microsoft Store. The repo can also deploy MSFT Store apps (at least in EA) at this time. Those options may be easier.
03-21-2024 01:19 PM
But now that I think of it... we have a privilege elevation feature in early access that would be even easier.
Least privilege is an important security practice, but there are situations when a user may require admin rights (it’s almost always printers). We’re introducing privilege management that’s as-needed, and fully audited, to grant elevated permissions on a fully managed basis.
Directory Insights will help you track events with a full audit trail for your compliance lifecycle. Privilege management will simplify support while ensuring strong entitlement management
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.