How to Get Started

Here are the basic steps for getting started with API calls that are executed from a PowerShell console.

1.From the Security Controls console, launch a Windows PowerShell console.

Be sure to specify Run as Administrator when launching the PowerShell console.

2.Load the STProtect API module by executing the following PowerShell command:

PS C:\Import-Module STProtect –PassThru

The STProtect API module contains API calls that allow you to interact with many of the functional areas within Security Controls. The optional –PassThru option provides diagnostic feedback about how the module is loaded.

You should always load the module first whenever you write a script. One way to ensure that the module is always loaded is to add the module import command to your PowerShell user profile.

3.Load any other required Windows or third-party modules.

You may need commandlets from other modules in order to interact with other devices in your environment. For example:

Servermanager: Required in order to interact with the SQL cluster.

Failoverclusters: Loads Windows feature RSAT-Clustering.

4.Execute individual commands or scripted commands.

For the complete list of available commands, see How to View Detailed Help Information About the PowerShell Commands.

Here are a few popular examples:

Perform a patch scan

Start-PatchScan –MachineGroups “My Machine”

Start and view results of a patch scan

Start-PatchScan –MachineGroups “My Machine” | Watch-PatchScan

Deploy missing patches

Start-PatchDeploy –Uid 12345678-3BD2-A0ED-FFCC-9876DE8EBBAA

5.When finished, close the Windows PowerShell console.

All modules that you imported or items that you stored in memory will be erased when the PowerShell console is closed. Scan or deployment operations that you initiated will not stop when PowerShell closes.