Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param(
- [string]$AppToCheckIfInstalled
- )
- if ($AppToCheckIfInstalled) {
- Write-Host Checking if the application $AppToCheckIfInstalled has already been installed...
- # $cmdOutput = $AppToCheckIfInstalled 2>&1
- $rawOutput = (cmd /c $AppToCheckIfInstalled 2`>`&1)
- if ($rawOutput -like "*'$AppToCheckIfInstalled' is not recognized*") {
- Write-Host "$AppToCheckIfInstalled not installed yet"
- }
- else {
- Write-Host "$AppToCheckIfInstalled already installed"
- }
- }
- else {
- Write-Host "Missing application name, exiting..."
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement