Skip to content

Instantly share code, notes, and snippets.

@contactbrenton
Last active January 30, 2024 23:37
Show Gist options
  • Save contactbrenton/428677d6e59b04ffd4c49b3d7a1aacdf to your computer and use it in GitHub Desktop.
Save contactbrenton/428677d6e59b04ffd4c49b3d7a1aacdf to your computer and use it in GitHub Desktop.
# Define the paths for both x64 and x86 versions of the Dell Command Update CLI
$dcuPathX64 = "${env:ProgramFiles}\Dell\CommandUpdate\dcu-cli.exe"
$dcuPathX86 = "${env:ProgramFilesX86}\Dell\CommandUpdate\dcu-cli.exe"
# Check if Dell Command Update is installed (either x64 or x86)
$dcuPath = if (Test-Path $dcuPathX64) {
$dcuPathX64
} elseif (Test-Path $dcuPathX86) {
$dcuPathX86
} else {
# Install Dell Command Update using Chocolatey
Write-Host "Dell Command Update is not installed. Installing now..."
Start-Process -FilePath "choco" -ArgumentList "install dellcommandupdate -y" -Wait -NoNewWindow
# Assuming Chocolatey installs x64 version
$dcuPathX64
}
# Function to check for Dell updates
function CheckDellUpdates {
Start-Process -FilePath $dcuPath -ArgumentList "/scan -silent" -Wait -NoNewWindow
Start-Process -FilePath $dcuPath -ArgumentList "/log show" -Wait -NoNewWindow
}
# Check for Dell updates before applying them
Write-Host "Checking for Dell updates before applying..."
CheckDellUpdates
# Apply Dell updates
Write-Host "Applying Dell updates..."
Start-Process -FilePath $dcuPath -ArgumentList "/applyUpdates -updateType=bios,driver,firmware -reboot=disable" -Wait -NoNewWindow
# Check for Dell updates after applying them
Write-Host "Checking for Dell updates after applying..."
CheckDellUpdates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment