CMD Install Software, Apps & Features - Neilitlib/MSP-Simple-Commands GitHub Wiki
- You can see the REPEATABLE code format of these is to create an Apps folder in the root C:\ directory if one does not exist
- Then use the Invoke-WebRequest to download a file from a specific URL to the Apps folder
- Then use the Start-Process to begin the installation with various syntax such as -silent, -quiet, etc
- You can modify the folder and path that gets created
- You can host your own files to be downloaded on your company website; EX: https://mspcompany.com/files/filename.exe
- Typically does NOT WORK with cloud download links, like OneDrive shares, even with direct URLs to those files
Generic *.EXE Install
$folderPath = "C:\apps"; $url = "http://www.website.com/software.EXE"; $outputFile = "C:\apps\software.EXE"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath $outputFile -ArgumentList "/silent /install"
Generic *.MSI Install
$folderPath = "C:\apps"; $url = "http://www.website.com/software.MSI"; $outputFile = "C:\apps\software.MSI"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $outputFile /quiet /silent" -Wait
Active Directory Lightweight Directory Services – Windows Feature
PS
Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -like "*AD LDS*"}; if ($?) { Write-Host "Command succeeded" } else { Write-Host "Command failed" }
Active Directory Domain Services – Optional Windows Feature
CLI
- Install:
DISM /Online /Add-Capability /CapabilityName:Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0
- Check Status:
DISM.exe /Online /Get-CapabilityInfo /CapabilityName:Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0
Adobe
PS
folderPath = "C:\apps"; $url = "ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/2001320064/AcroRdrDC2001320064_en_US.exe"; $outputFile = "C:\apps\AcroRdrDC2001320064_en_US.exe"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath $outputFile -ArgumentList "--silent --install"
The exact address is subject to change depending on the version you need, or simply host your own file on your company website.
Chrome
PS
$folderPath = "C:\apps"; $url = "http://dl.google.com/chrome/install/latest/chrome_installer.exe"; $outputFile = "C:\apps\chrome_installer.exe"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath $outputFile -ArgumentList "/silent /install"
Libre Office
PS
$LibreOfficeUri = "https://downloadarchive.documentfoundation.org/libreoffice/old/7.3.7.2/win/x86_64/LibreOffice_7.3.7.2_Win_x64.msi"; $LibreOfficeInstaller = "$env:TEMP\LibreOffice.msi"; (New-Object System.Net.WebClient).DownloadFile($LibreOfficeUri, $LibreOfficeInstaller); Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $LibreOfficeInstaller /quiet" -Wait
The exact address is subject to change depending on the version you need, or simply host your own file on your company website.
Write-Output "INFO: Setting Libre Office as default app for ALL CURRENT-EXISTING USERS (NOT Future-New Users), to handle old & new Word, Excel, and PowerPoint file formats"; $WordRegKey = "Registry::HKEY_CLASSES_ROOT\.doc"; $ExcelRegKey = "Registry::HKEY_CLASSES_ROOT\.xls"; $PowerPointRegKey = "Registry::HKEY_CLASSES_ROOT\.ppt"; $WordRegKeyX = "Registry::HKEY_CLASSES_ROOT\.docx"; $ExcelRegKeyX = "Registry::HKEY_CLASSES_ROOT\.xlsx"; $PowerPointRegKeyX = "Registry::HKEY_CLASSES_ROOT\.pptx"; if (!(Test-Path $WordRegKey)) { New-Item -Path $WordRegKey -Force | Out-Null }; Set-ItemProperty -Path $WordRegKey -Name "(Default)" -Value "LibreOffice.WriterDocument.1"; if (!(Test-Path $ExcelRegKey)) { New-Item -Path $ExcelRegKey -Force | Out-Null }; Set-ItemProperty -Path $ExcelRegKey -Name "(Default)" -Value "LibreOffice.CalcDocument.1"; if (!(Test-Path $PowerPointRegKey)) { New-Item -Path $PowerPointRegKey -Force | Out-Null }; Set-ItemProperty -Path $PowerPointRegKey -Name "(Default)" -Value "LibreOffice.ImpressDocument.1"; if (!(Test-Path $WordRegKeyX)) { New-Item -Path $WordRegKeyX -Force | Out-Null }; Set-ItemProperty -Path $WordRegKeyX -Name "(Default)" -Value "LibreOffice.WriterDocument.1"; if (!(Test-Path $ExcelRegKeyX)) { New-Item -Path $ExcelRegKeyX -Force | Out-Null }; Set-ItemProperty -Path $ExcelRegKeyX -Name "(Default)" -Value "LibreOffice.CalcDocument.1"; if (!(Test-Path $PowerPointRegKeyX)) { New-Item -Path $PowerPointRegKeyX -Force | Out-Null }; Set-ItemProperty -Path $PowerPointRegKeyX -Name "(Default)" -Value "LibreOffice.ImpressDocument.1"; Write-Output "INFO: Done!"
This PowerShell script does two main things:
- Downloads and Installs LibreOffice: The script first defines a URL to the LibreOffice installer and a local path where the installer will be downloaded. It then uses
Invoke-WebRequest
to download the installer from the specified URL to the local path. After the download is complete, it starts the installation process usingmsiexec.exe
with the/i
(install) and/quiet
(silent install) options.- Sets LibreOffice as the Default Application: The script outputs an informational message about setting LibreOffice as the default application for handling Word, Excel, and PowerPoint file formats for all current users. It then defines registry keys for each file format (.doc, .xls, .ppt, .docx, .xlsx, .pptx). For each file format, it checks if the registry key exists. If not, it creates a new one. It then sets the default value of the registry key to the corresponding LibreOffice application (Writer for .doc and .docx, Calc for .xls and .xlsx, Impress for .ppt and .pptx). Finally, it outputs a message indicating that the operation is done. Please note that this script should be run with administrative privileges as it involves changes to the system registry and software installation. Also, be aware that it sets LibreOffice as the default application for the mentioned file formats for all current users, but not for future new users. Always be cautious when running scripts that modify your system configuration.
FreeFileSync
PS
$folderPath = "C:\apps"; $url = "https://freefilesync.org/download/FreeFileSync_13.0_Windows_Setup.exe"; $filePath = Join-Path -Path $folderPath -ChildPath "FreeFileSync_13.0_Windows_Setup.exe"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $filePath); Start-Process -FilePath $filePath -ArgumentList "/install"
The exact address is subject to change depending on the version you need, or simply host your own file on your company website.
FileZilla
PS
$folderPath = "C:\apps"; $url = "https://download.filezilla-project.org/client/FileZilla_3.65.0_win64-setup.exe"; $outputFile = "C:\apps\FileZilla_3.65.0_win64-setup.exe"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath $outputFile -ArgumentList "/silent /install"
The exact address is subject to change depending on the version you need, or simply host your own file on your company website.
FireFox
PS
$folderPath = "C:\apps"; $url = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US"; $filePath = Join-Path -Path $folderPath -ChildPath "Firefox.exe"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $filePath); Start-Process -FilePath $filePath -ArgumentList "-ms"
Nitro PDF PRO
PS
$folderPath = "C:\apps"; $url = "https://downloads.gonitro.com/professional_14.26.1.0/en/nls/nitro_pro14_x64.msi"; $outputFile = "C:\apps\nitro_pro14_x64.msi"; if (!(Test-Path -Path $folderPath)) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $outputFile /qn" -Wait
RingCentral
PS
if (!(Test-Path -Path "C:\apps")) { New-Item -ItemType directory -Path "C:\apps" }; (New-Object System.Net.WebClient).DownloadFile("https://app.ringcentral.com/download/RingCentral.exe", "C:\apps\RingCentral.exe"); Start-Process -FilePath "C:\apps\RingCentral.exe" -ArgumentList "/silent /install"
Teams for Work/School
PS
Get-AppxPackage -Name MicrosoftTeams* | Remove-AppxPackage -AllUsers; Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -like "*MicrosoftTeams*" } | Remove-AppxProvisionedPackage -Online -Verbose; $folderPath = "C:\apps"; $url = "https://statics.teams.cdn.office.net/evergreen-assets/DesktopClient/MSTeamsSetup.exe"; $outputFile = "C:\apps\TeamsSetup.exe"; if(!(Test-Path -Path $folderPath )) { New-Item -ItemType directory -Path $folderPath }; (New-Object System.Net.WebClient).DownloadFile($url, $outputFile); Start-Process -FilePath $outputFile -ArgumentList "-s" -Wait
The exact address is subject to change depending on the version you need, or simply host your own file on your company website.