How to deploy PS script via gpo

This is my script need to push to our client machine from gpo.

This script runs the FortiESNAC.exe command with the specified IP address argument

$ipAddress = “192.168.10.8”
$fortiClientPath = “C:\Program Files\Fortinet\FortiClient\FortiESNAC.exe”

Check if FortiClient path exists

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 have created the gpo policy and push but its not working in our environment, please help me and validate my powershell script.

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.

Guide to formatting - https://global.discourse-cdn.com/business5/uploads/powershell/original/2X/b/bee50c628238f2c076c0504efb6b15f2fb11f002.gif

1 Like

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