Get-InstalledApplication - Error - Help Please

Hello

Could someone advise what I am doing wrong here. I want to be able to check to see if Microsoft Visual C++ is installed. If it isn’t then I would like it to run the installer.

I have tried with the below - but am not having much luck. Can someone please let me know what I am missing.

I am running the below command under the Installation section of the script.

$SoftwareCheck Get-InstalledApplication -Name "Microsoft Visual C\+\+ 2022"
        If $SoftwareCheck -eq $null {Execute-Process -Path "VC_redist.x64.exe" -Parameters "/SILENT"
        
        }

When I run this - I get the below error

At line:1 char:16
+ $SoftwareCheck Get-InstalledApplication -Name "Microsoft Visual C\+\+ ...
+                ~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'Get-InstalledApplication' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

You don’t have = after $SoftwareCheck

$SoftwareCheck = Get-InstalledApplication -Name "Microsoft Visual C\+\+ 2022"
        If ($SoftwareCheck -eq $null) {
           Execute-Process -Path "VC_redist.x64.exe" -Parameters "/SILENT"
        }
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.