Showing results for 
Search instead for 
Did you mean: 

Using PowerShell to Install a Printer ... using ChatGPT

Rising Star III
Rising Star III

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 = ""

# 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. 


Screenshot 2023-02-23 at 4.21.53 PM.png