$applicationArray = $filezilla = "C:\Program Files\FileZilla FTP Client\filezilla.exe", $notepad = "C:\Program Files\Notepad++\notepad++.exe", $cisco = "C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe", $adobe = "C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe"
foreach ($application in $applicationArray)
{
Test-path
if (Test-path)
{
Write-Host "Folder Exists"
}
else
{
Write-Host "Folder Does Not Exist"
}
}
I am trying to write a script that will check if the above programs are installed by useing the "Test-path" command. when I run them in individual "if" statements they all work but I was looking to loop it so I could compress the script to be as eficient as possible. but when I try to run the above I get the below error:
At C:\Users\Nicholas.McKinney\OneDrive - Brandmuscle\Documents\Scripts\Laptop_Setups.ps1:1 char:34
+ ... filezilla = "C:\Program Files\FileZilla FTP Client\filezilla.exe", $n ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property.
At C:\Users\Nicholas.McKinney\OneDrive - Brandmuscle\Documents\Scripts\Laptop_Setups.ps1:1 char:100
+ ... a.exe", $notepad = "C:\Program Files\Notepad++\notepad++.exe", $cisco ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property.
At C:\Users\Nicholas.McKinney\OneDrive - Brandmuscle\Documents\Scripts\Laptop_Setups.ps1:1 char:153
+ ... ", $cisco = "C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mob ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidLeftHandSide