How to: Use the NSS PowerShell Toolkit

Summary

The purpose of this article is to explain what the NSS PowerShell Toolkit is and how it can be used.

The NSS PowerShell Toolkit is a utility that offers a more user friendly approach when working with the NSSX API to create automated scripts. Similar to command-line tools, the NSS PowerShell Toolkit provides a layer of abstraction between the operator and the underlying API, hiding complexity and allowing simple tasks to be performed efficiently.

Pre-requisites

In order to utilize the capabilities of the NSS PowerShell Toolkit the following requirements must be fulfilled:

  • NSS version 9.7 SR2 (or later) must be installed
  • Windows Powershell 3.0 (or later) needs to be installed on the NSS server (Windows Powershell 4.0 ISE recommended)
  • The Windows PowerShell execution policy must be set to at least AllSigned.
    • Check the current signing policy with: Get-ExecutionPolicy
    • To set the execution policy use: Set-ExecutionPolicy -ExecutionPolicy AllSigned

The toolkit can be found in the NSS installation package. Copy the content to a suitable path on the NSS server (e.g. C:\NSS-Utilities\NSSTookit\).

IMPORTANT:

It's very common that Windows blocks scripts, .dll-files and similar files coming from an external source, leading to a situation where the files need to be unblocked one by one before they can be used. This usually happens to the NSS Toolkit. Luckily, there's a quick solution to this problem through the use of a command in Windows Powershell.

Enter Powershell as an Administrator and run the following command to unblock the files in an instant:

  • dir -Path [directory path] -Recurse | Unblock-File 

This command recurses through the entire directory specified and unblocks all files, making it possible to use the NSS Toolkit as intended.

Usage

This section explains how the NSSToolkit can be used and the functions that can be utilized.

First you will need to load the NSSToolkit module:

In PowerShell ISE enter:

  • Import-Module 'C:\NSS-Utilities\NSSToolkit\NSSToolkit.psm1'

If you are not running the Execution Policy with Bypass you will need to approve the module with Always run.

The table below lists the commands available for use in your PowerShell scripts:

Access Rules

FUNCTION DESCRIPTION FROM VERSION
Get-AccessRule Gets the Application Role for a single user 9.7 SR2 
Get-AccessRules

Gets the list of all defined Application Roles

9.7 SR2

Add-AccessRuleForUser

Adds an Access Rule for a single user 9.7 SR2
Add-PathRulesForUser Adds access to one or several paths for a single user 9.7 SR2
Remove-AccessRule Removes the specified path(s) from a specified user's Access Rule 9.7 SR2
Remove-AccessRuleForUser Deletes all Access Rules for a single user or group 9.7 SR2
Remove-PathAccessByCreator Deletes all path access with a specific creator string 9.7 SR2
Remove-PathAccessForUser Removes path access for a single user 9.7 SR2
Get-EffectivePermissions Returns effective NSS permissions for a user and all the groups that the user is a member of 9.8
Get-AccessRulesPaths Returns a full list of defined Access Rule paths and Path Roles for a single user 9.8

 

 

Path Labels

FUNCTION DESCRIPTION FROM VERSION
Add-PathLabel

Adds a Path Label with expressions or without

9.7 SR2

Set-PathLabelToPath

Sets a value for an individual path
9.7 SR2

Remove-PathLabel

Removes a specified Path Label(s)
9.8
Remove-PathLabelForPath Removes a specified path label for a specified path 9.8

 

View Profiles

FUNCTION DESCRIPTION FROM VERSION
Get-ViewProfiles

Gets All View profiles from NSS Console REST API

9.7 SR2

Remove-ViewProfile

Removes a specific View Profile 9.7 SR2
Add-ViewProfileFromUserView Adds a View Profile from current user view 9.7 SR2
Set-ViewProfileFromUserView Updates an existing View Profile from current user view 9.7 SR2
Get-UserView Returns current user's configured views 9.7 SR2
Set-UserView Sets views for current user 9.7 SR2

 

Data Scan

FUNCTION DESCRIPTION FROM VERSION
Get-DataScan

Returns the full Data Scan configuration for the specified server

9.8
Get-RunningScans Returns information about any scans currently being run by the specified server 9.8
Stop-RunningScan Stops any scans currently running on the specified NSS host 9.8

 

Quota Integration

FUNCTION DESCRIPTION FROM VERSION
Get-QSServerSettings Returns the Quota Server settings for a specified NSS host 9.8
Get-QSSyncConfiguration Returns the quota synchronisation configuration for one or all quota server servers 9.8
Set-QSServerSettings Set quota server settings for a specified quota server server 9.8
Set-QSSyncConfiguration Set the quota synchronization configuration (for quota display in NSS Console interface) for one or more quota server servers 9.8



Help & Further Explanations

Further general documentation can be found in the NSS Toolkit package. Go to the directory where the package has been placed and then navigate to\NSSToolkit\docs\html\index.html.

For more details on the use of each function, a help resource is available via a Get-Help command in PowerShell. These resources describe the different options for the function in question. The example below shows the help resource available for the Get-AccessRules function.

  • Get-Help Get-AccessRules -Full

Get-AccessRules Help

It is also possible to retrieve examples for each function by typing -examples at the end of the command. In the example below we're looking at the available examples for the Set-PathLabelToPath function.

  • Get-Help Set-PathLabelToPath -examples

Set-PathLabelToPath Examples

Please direct all questions to the Technical Support team at Northern (support@northern.net). We look forward to assisting you.

ADDITIONAL RESOURCES

  • KB3158 How to: Configure View Profiles
  • KB Article: 3150

    Updated: 3/22/2017

    • Category
      • Usage
    • Affected versions
      • 9.70.20083.1605 [9.7 SR2]
      • 9.70.20161.1606 [9.7 SR3]
      • 9.70.20304.1608 [9.7 SR4]
      • 9.70.20363.1609 [9.7 SR5]
      • 9.80.20518.1611 [9.8]

    North America HQ

    NORTHERN Parklife, Inc.
    301Edgewater Place, Suite 100
    Wakefield, MA 01880
    USA

    Voice: 781.968.5424
    Fax: 781.968.5301

    salesUS@northern.net

     

    Additional Contact Information

    EMEA & APAC HQ

    NORTHERN Parklife AB
    St. Göransgatan 66
    112 33 Stockholm
    Sweden

    Voice: +46 8 457 50 00

    salesHQ@northern.net

    Northern Parklife



    ©2017 northern parklife

    privacy statement 
    terms of use