Using PowerShell cmdlets

Using and understanding cmdlets

Stormshield Data Connector comes with a ready-to-use PowerShell module containing cmdlets that allow running Stormshield Data Security. Each cmdlet enables the use of a function on the product.

For example, in order to retrieve an object corresponding to the logged in user, use the following cmdlet in a PowerShell console:

PS C:\> Get-SDSUser

Id                    : asmith
Name                  : Alice Smith
Locked                : False
EmailAddresses        : {asmith@mycompany.com}
EncryptionCertificate : Alice SMITH
SignatureCertificate  : Alice SMITH
				

The list of available cmdlets can be retrieved using the command

Get-Command –Module Stormshield.DataSecurity.Connector.PowerShell

To get help and examples for each cmdlet, enter

Get-Help -Full <name-of-the-cmdlet>

More information about these cmdlets can be found in the List of the Stormshield Data Connector cmdlets.

TIP
On a 64-bit operating system, use a 64-bit PowerShell console.

Understanding the Windows PowerShell script execution policy

By default, Windows blocks the execution of PowerShell scripts.

The Get-ExecutionPolicy cmdlet allows knowing the current execution policy in force. The Windows PowerShell execution policies include the following :

  • Restricted: No scripts can be run.
  • AllSigned: Only scripts signed by a trusted publisher can be run.
  • RemoteSigned: Scripts created locally will run but those downloaded from a network will not (unless they are digitally signed by a trusted publisher).
  • Unrestricted: All Powershell scripts can be run.

The Set-ExecutionPolicy cmdlet allows changing the current user preference for the PowerShell execution policy. For example, if you want to execute a local PowerShell script, indicate the following cmdlet in a PowerShell window (“Run as administrator”) :

Set-ExecutionPolicy RemoteSigned