This PowerShell module provides a set of functions to interact with SonicWall appliances using its SonicOS API.
First of all you must activate the SonicOS API in your SonicWall appliance. SonicOS API was introduced in SonicOS 6.5.1 so if you have a previous version you must first upgrade your appliance in order to use this module.
To activate the SonicOS API you can follow these steps(instructions taken from the SonicOS API Reference):
- Navigate to MANAGE | Network > Appliance | Base Settings.
- Scroll to the SonicOS API section.
- Select Enable SonicOS API.
- Select Enable RFC-2617 HTTP Basic Access authentication.
- Click Accept.
Connecting and disconnecting to a SonicWall Appliance
The first step for accessing the SonicOS API using PSSonicWall is to connect to the appliance. For that purpose you can use Connect-SWAppliance:
Connect-SWAppliance -Server 192.168.168.168
When you are done with the API interaction you should disconnect your session. To do so you can use Disconnect-SWAppliance:
Using Get functions
Once you are connected you can use PSSonicWall to read all the information that SonicOS API can offer. Here's a list of the Get commands currently available:
|Get-SWAccessRule||Retrieve Access Rules|
|Get-SWAddressGroup||Retrieve Address Groups|
|Get-SWAddressObject||Retrive Address Objects|
|Get-SWDns||Retrieve DNS configuration|
|Get-SWNatPolicy||Retrieve NAT Policies|
|Get-SWRoutePolicy||Retrieve Routing Policies|
|Get-SWServiceGroup||Retrieve Service Groups|
If you want to know more about a certain function you can use Get-Help NameOfTheFuncion to know more.