diff --git a/App Update Scripts/Dell Command Update - Update Everything.ps1 b/App Update Scripts/Dell Command Update - Update Everything.ps1 new file mode 100644 index 0000000..68fa273 --- /dev/null +++ b/App Update Scripts/Dell Command Update - Update Everything.ps1 @@ -0,0 +1,104 @@ +<# +Author: Gabe Kerntke +Date: 02-18-2025 + +.Synopsis + +.Modified +2025-02-18 (GabeK) - Original script created +2025-07-01 (GabeK) - Script updated to use version 5.5 and use functions script +#> + +# Variables # +$App_Name = "Dell Command" +$File_Name_Prefix = "Dell-Command-x64" +$File_Name_Extension = "exe" +$Install_Parameters = "/s" +$EPCache_Folder = "3rd Party Patches\$App_Name" +$Version_URL = (Invoke-WebRequest -UseBasicParsing "https://www.dell.com/support/kbdoc/en-us/000177325/dell-command-update").Content | Select-String -Pattern '' -AllMatches | +ForEach-Object { $_.Matches } | ForEach-Object { $_.Groups[1].Value } | Select-Object -First 1 +$A = $Version_URL.Substring(30) +$Online_Version = $A.Substring(0, $A.Length - 10) -replace "[^\d*\.?\d*$/]" , '' -replace "/" , "" +$DownloadURL = "https://downloads.dell.com/FOLDER13309588M/1/Dell-Command-Update-Windows-Universal-Application_C8JXV_WIN64_5.5.0_A00.EXE" +$File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension" +$Manufacturer = (Get-CimInstance Win32_ComputerSystem).Manufacturer + +# Functions # + +Function Initialize-Commands { + .\dcu-cli.exe /scan + .\dcu-cli.exe /applyUpdates -silent + $BLinfo = Get-Bitlockervolume + If ($blinfo.ProtectionStatus -eq 'On' -and $blinfo.EncryptionPercentage -eq '100') { + Manage-bde -Protectors -Disable C: -RebootCount 1 + } + Restart-Computer -Force +} + +Function Invoke-Commands { + If (Test-Path "C:\Program Files\Dell\CommandUpdate\") { + Set-Location "C:\Program Files\Dell\CommandUpdate\" + Initialize-Commands + } + ElseIf (Test-Path "C:\Program Files (x86)\Dell\CommandUpdate\") { + Set-Location "C:\Program Files (x86)\Dell\CommandUpdate\" + Initialize-Commands + } + Else { Write-Host "Dell Command Update isn't installed, trying running the script again." } +} + +Function Uninstall-App { + $Uninstall = Get-WmiObject Win32_Product -filter "name like '$App_Name%'" | ForEach-Object { $_.Uninstall() } + $Value = $Uninstall | Select-Object -ExpandProperty ReturnValue + + If ($Value -eq "0") { + Write-Host "$App_Name uninstalled successfully, please rerun script to continue." + $BLinfo = Get-Bitlockervolume + If ($blinfo.ProtectionStatus -eq 'On' -and $blinfo.EncryptionPercentage -eq '100') { + Manage-bde -Protectors -Disable C: -RebootCount 1 + } + Restart-Computer -Force + } + Else { + Write-Host "Failed to uninstall $App_Name, exiting script" + Exit + } +} + +Function Install-dot_net { + Invoke-WebRequest -UseBasicParsing "https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/8.0.17/windowsdesktop-runtime-8.0.17-win-x64.exe" -OutFile "C:\Temp\windowsdesktop-runtime-8.0.17-win-x64.exe" + Start-Process "C:\Temp\Script Cache\windowsdesktop-runtime-8.0.17-win-x64.exe" -ArgumentList "/install /quiet /norestart" + Start-Sleep 15 + Remove-Item "C:\Temp\Script Cache\windowsdesktop-runtime-8.0.17-win-x64.exe" -Force +} + +#Region Script Start +If ((Test-Path "C:\Temp\Script Cache") -eq $False) { New-Item -ItemType directory -Path "C:\Temp\Script Cache" } +Invoke-WebRequest -UseBasicParsing "https://scripts.gabesville.com/Gabesville/Powershell-Scripts/raw/branch/main/Functions%20Scripts/Functions.ps1" -outfile "C:\Temp\Script Cache\Functions.ps1" +. "C:\Temp\Script Cache\Functions.ps1" + +#Check if device is a dell +If ($Manufacturer -eq "Dell Inc.") { + #Check to see if program is installed + $Applist = Get-Software | Sort-Object -Descending + + If ($Applist.DisplayName -like "*$App_Name*") { + #Get currently installed version + $Local_Version = Get-Software | Where-Object { $_.DisplayName -like "*$App_Name*" } | Select-Object -ExpandProperty DisplayVersion + + #Comparing version already installed to what is online + If ($Local_Version -lt $Online_Version) { + Close-App + Uninstall-App + } + Else { Invoke-Commands } + } + Else { + Install-dot_net + Test-Probe_Online + Install-App + Invoke-Commands + } +} +Else { Write-Host "Device is not a Dell: $Manufacturer" } +#Region End Script \ No newline at end of file