if (Test-Path $fortiClientPath) {
# Run the FortiESNAC command with the IP address argument
& $fortiClientPath -r $ipAddress
}
else {
Write-Host “FortiClient path not found: $fortiClientPath”
}
I would run your script manually to “validate” it. We don’t have your environment available to us, so that is up to you to validate. Also, you don’t share how you push your script through GPO, so after you’ve validated your script you may want to change the discussion to how you are pushing it out. Be sure to share details about what does happen vs what you expected to happen. (at that point it may not even be a powershell issue, so consider if this is the best site for it.) Finally, always post code and errors with the preformatted text option so that it can read easily and nothing happens to the characters.