Restore‐OPNsenseConfig - fvanroie/PS_OPNsense GitHub Wiki

Synopsis

Restore the OPNsense config.xml file

Syntax

Restore-OPNsenseConfig [-Xml] <String> [-Password <String>] `
             [-WhatIf] [-Confirm] [<CommonParameters>]
Restore-OPNsenseConfig [-Path] <FileInfo> [-Password <String>] `
             [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Upload the contents of config.xml to the OPNsense server. This cmdlet will overwrite the current configuration with the new configuration. You can specify either a path to a file or pass the contents of the XML directly. WARNING: The server will reboot automatically after restoring the configuration.

If required, use the Backup-OPNsenseConfig cmdlet first to save a local copy of the config.xml file before overwriting the current configuration.

Parameters

-Xml   <String>

The XML string to restore to the config.xml file on the server.

Required? true
Position? 1
Default Value?
Pipeline Input? false

-Password   <String>

The password to decrypt the config.xml file in case it is encrypted.

Required? false
Position? named
Default Value?
Pipeline Input? false

-WhatIf   <SwitchParameter>

Required? false
Position? named
Default Value?
Pipeline Input? false

-Confirm   <SwitchParameter>

Required? false
Position? named
Default Value?
Pipeline Input? false

-Path   <FileInfo>

Local path of the config.xml file to restore back to the server.

Required? true
Position? 1
Default Value?
Pipeline Input? false

Examples

Write a new config.xml file

Get-Content C:\Backup\config.xml | Restore-OPNsenseConfig
⚠️ **GitHub.com Fallback** ⚠️