Forum Discussion
Powershell as win32 not working
- Oct 25, 2023
ABill1 Like this:
# Check if the "Block Chrome" firewall rule exists
$rule = Get-NetFirewallRule -DisplayName "Block Chrome"
if ($rule) {
Write-Host "Firewall rule 'Block Chrome' already exists."
Exit 0
} else {
Write-Host "Firewall rule 'Block Chrome' does not exist."
Exit 1}
In the Detection script, you have to do an output (which you did using Write-Host), but you have to exit with 0 if successful (exit 0). Exit with 1 if failed, in which case the install script should run (exit 1)
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If one of the posts was helpful in other ways, please consider giving it a Like.
- Oct 25, 2023
ABill1 Like this:
# Check if the "Block Chrome" firewall rule exists
$rule = Get-NetFirewallRule -DisplayName "Block Chrome"
if ($rule) {
Write-Host "Firewall rule 'Block Chrome' already exists."
Exit 0
} else {
Write-Host "Firewall rule 'Block Chrome' does not exist."
Exit 1}