Invoke‐OPNsenseCommand - fvanroie/PS_OPNsense GitHub Wiki
Execute an OPNsense command against the REST api of a connected server
Invoke-OPNsenseCommand [-Module] <String> [-Controller] <String> [-Command] <String> `
-Form <Object> [-OutFile <FileInfo>] [-AddProperty <Object>]Invoke-OPNsenseCommand [-Module] <String> [-Controller] <String> [-Command] <String> `
-Json <Object> [-OutFile <FileInfo>] [-AddProperty <Object>]Invoke-OPNsenseCommand [-Module] <String> [-Controller] <String> [-Command] <String> `
[-OutFile <FileInfo>] [-AddProperty <Object>]The Invoke-OPNsenseCommand cmdlet will execute a command againt the OPNsense server REST api. This can be a simple query. You can also POST objects using a simple Form or complex Json structure.
Use the Connect-OPNsense cmdlet first to establisch a connection. Subsequent calls will not need credentials until you disconnect using Disconnect-OPNsense cmdlet.
If you specify an AddProperty HashTable, the Objects returned will each include the properties specified.
-Module <String>
API module
| Required? | true |
| Position? | 1 |
| Default Value? | |
| Pipeline Input? | false |
-Controller <String>
API controller
| Required? | true |
| Position? | 2 |
| Default Value? | |
| Pipeline Input? | false |
-Command <String>
API command
| Required? | true |
| Position? | 3 |
| Default Value? | |
| Pipeline Input? | false |
-Json <Object>
Json object to POST
| Required? | true |
| Position? | named |
| Default Value? | |
| Pipeline Input? | false |
-Form <Object>
Form object to POST
| Required? | true |
| Position? | named |
| Default Value? | |
| Pipeline Input? | false |
-AddProperty <Object>
Add extra property or properties to the return object
| Required? | false |
| Position? | named |
| Default Value? | |
| Pipeline Input? | false |
-OutFile <FileInfo>
| Required? | false |
| Position? | named |
| Default Value? | |
| Pipeline Input? | false |
Invoke-OPNsenseCommand core firmware infoInvoke-OPNsenseCommand ids settings test -Json @{ key1 = value1; key2 = value2 }Invoke-OPNsenseCommand core firmware status -AddProperty @{server='opnsense.local'}