Adding multiple lines inside french brackets to action multiple tasks

Hello All,

Is it possible include multiple tasks in the IF loop for example say after echoeing “computer name found” then I want to run get-hotfix and write a message on screen to say searching for hotfixes,

$testConnection = Test-Connection $computername
IF ($testConnection = “True”)
{Write-Host “$computername found” }


Would it hurt you when you tried? What could happen? Did you try to search for it?

BTW: Usually your code should look like this:

IF (Test-Connection $computername ) {
“$computername online”

The “=” is the assign operator not a comparison operator. That would be “-eq” and you don’t compare to “True” you’d compare to $true. :wink:

Please start by learning the very basics of Powershell first.

“French brackets”. I like it.

Short answer, “Yes”


long answer, study the output of get-help about_if