What It Does
The script undoes enable-network-isolation step by step. It saves the firewall policy as it is now, deletes the Windows Firewall rule group named MSP Outpost Isolation, and puts the Domain, Private and Public profiles back to the settings that were saved before isolation: firewall on or off, default inbound and outbound action, and inbound rules. It switches back on the outbound allow rules the isolation turned off, deletes the auto-undo scheduled task if one was made, and deletes its saved state file.
If isolation rules exist but saved settings are missing, the script warns that it is restoring default outbound Allow and enabling inbound allow rules. If there are no isolation rules, saved state or auto-undo task, a separate outbound block is left alone and reported.
It checks the connection using the saved first allowed host or the default gateway, using a ping, a TCP connect or refusal on 443, 80 or 53, or a DNS reply. If the available targets do not answer, it reports an error after restoring the firewall. If there is no target to test, it warns that it could not verify connectivity.
BackupPath is the other way back. Give it the .wfw policy backup made by enable-network-isolation and the whole firewall policy is restored from it, which also undoes any firewall rule changed since. If there are no isolation rules, saved state or auto-undo task, the script leaves the firewall policy alone, even with BackupPath set.
Before You Run It
- Run it with DryRun=true first and read the list of what it would change.
- Make sure the threat is dealt with. Ending isolation puts the PC back on the network.
- Keep the backup path from the isolation run handy in case you need BackupPath.
- If it ends in ERROR on the connection test, check the network, cabling and gateway. The firewall has already been restored.
Type and Risk
- Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
- Risk: Low. Set DryRun=true, or run it with -WhatIf, to list every change without making any.
- What it changes: Deletes the Windows Firewall rule group MSP Outpost Isolation and restores the saved firewall profile settings (or a policy backup).
- Restart: It never restarts the machine.
- Typical run: 10 to 40 seconds.
- Example answer: "Isolation removed; firewall restored; connection ok (192.168.1.1 via ping)"
- Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.
Inputs
Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.
- BackupPath: Optional. A .wfw policy backup to restore with netsh advfirewall import instead of the saved profile settings.
Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.