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.
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.