working on something similar and need to perform a install based on the results.
here is what is not working for me..
$IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
If($IsAppInst -eq "4.0.5"){prompt users}
else{perform install step}
when I run the script I get.. (Testing with version 3.5.0 PSAPPDT)
[dotPDNLLC_paint.net_4.0.5] setup started.
[03-19-2015 12:43:20.411] [Initialization] [PSAppDeployToolkitExt] :: Script [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitExtensions.ps1] dot-source invoked by [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMa
in.ps1]
[03-19-2015 12:43:20.415] [Initialization] :: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)
[03-19-2015 12:43:20.420] [Initialization] [Show-DialogBox] :: Display Dialog Box with message: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain
.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)...
[03-19-2015 12:43:24.942] [Initialization] [Show-DialogBox] :: Dialog Box Response: OK
if I simply highlight and run the code I get this:
PS C:\WINDOWS\system32> $IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
$IsAppInst
[03-19-2015 12:46:30.828] [Initialization] [Get-InstalledApplication] :: Get information for installed Application Name(s) [paint.net]...
[03-19-2015 12:46:30.915] [Initialization] [Get-InstalledApplication] :: Found installed application [paint.net] version [4.0.5] matching application name [paint.net]
4.0.5
thanks in advance
here is what is not working for me..
$IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
If($IsAppInst -eq "4.0.5"){prompt users}
else{perform install step}
when I run the script I get.. (Testing with version 3.5.0 PSAPPDT)
[dotPDNLLC_paint.net_4.0.5] setup started.
[03-19-2015 12:43:20.411] [Initialization] [PSAppDeployToolkitExt] :: Script [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitExtensions.ps1] dot-source invoked by [C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMa
in.ps1]
[03-19-2015 12:43:20.415] [Initialization] :: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)
[03-19-2015 12:43:20.420] [Initialization] [Show-DialogBox] :: Display Dialog Box with message: You cannot call a method on a null-valued expression. (at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain
.ps1: line 7731
at <ScriptBlock>, C:\WINDOWS\Brunswick\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7731
at <ScriptBlock>, C:\Windows\ccmcache\e\Deploy-paint.net.ps1: line 77)...
[03-19-2015 12:43:24.942] [Initialization] [Show-DialogBox] :: Dialog Box Response: OK
if I simply highlight and run the code I get this:
PS C:\WINDOWS\system32> $IsAppInst = Get-InstalledApplication -name 'paint.net'| Select "DisplayVersion" -ExpandProperty "DisplayVersion"
$IsAppInst
[03-19-2015 12:46:30.828] [Initialization] [Get-InstalledApplication] :: Get information for installed Application Name(s) [paint.net]...
[03-19-2015 12:46:30.915] [Initialization] [Get-InstalledApplication] :: Found installed application [paint.net] version [4.0.5] matching application name [paint.net]
4.0.5
thanks in advance