
About PowerShell and Stirling
Stirling functionality in PowerShell is provided by an addition to the PowerShell environment called a snap-in. Snap-ins extend the functionality of PowerShell by adding additional cmdlets to the standard PowerShell environment.
PowerShell performs tasks through the use of cmdlets. Cmdlets are commands in the PowerShell environment that are composed of verb-noun pairs. The verb defines the action to be performed, and the noun defines the item the action is performed on.
For example, to get the list of the available cmdlets in a PowerShell console, type the following in a PowerShell console:
Get-Command
This cmdlet "gets" a list of available "commands".
The output of a cmdlet varies depending on the cmdlet itself and any formatting parameters passed to the cmdlet.
About snap-ins
By default, only the standard PowerShell snap-ins are loaded, or added, to the default PowerShell console. To get a list of the snap-ins currently added to your PowerShell console, use the Get-PSSnapin cmdlet. Type the following in a PowerShell console:
Get-PSSnapin
The output is a list of all snap-ins currently added to the PowerShell console.
If your snap-in is not listed when you use Get-PSSnapin, you must add the snap-in to your PowerShell console. To determine the name of the snap-in, type the following in a PowerShell console:
Get-PSSnapin -Registered
The output is a list of all non-default snap-ins currently installed on your computer.
Once you have the name of the snap-in, you can add it to your PowerShell console. To do this, use the Add-PSSnapin cmdlet. Type the following in a PowerShell console:
Add-PSSnapin name of snapin
There is no output from this cmdlet. However, you can check the list of current snap-ins by using Get-PSSnapin to verify your snap-in was added.
To add the Stirling snap-in to your PowerShell console, type the following in a PowerShell console:
Add-PSSnapin ffspssnapin
The snap-ins added using Add-PSSnapin are only added for that console; if you close the PowerShell console and open it again, you must add the snap-in back into the PowerShell environment.
To load the Stirling snap-in every time you start a PowerShell console, you must create a PowerShell profile.
To create a PowerShell profile
-
Start Notepad, and then add the following line:
Add-PSSnapin ffspssnapin
-
On the menu bar, click File, and then click Save As.
-
In the folder list, browse to the folder location appropriate for the scope of the profile:
For a profile that affects all users of the computer, browse to the following location:
%windir%\system32\windowspowershell\v1.0
For a profile that affects only the current user, browse to the following location: %UserProfile%\My Documents\windowspowershell
-
In the File name box, enter Profile.ps1.
-
In the Save as type box, click on the down arrow, click All Files, and then click Save.
The Stirling snap-in will now be loaded each time you start PowerShell.
About parameters
Each cmdlet has parameters that are used to provide information to the cmdlet when it runs. Parameters are placed after the cmdlet and are preceded by a dash (-).
Parameters can be either mandatory or optional. Mandatory parameters are used to supply the cmdlet with information necessary to complete the task. Optional parameters are used to either modify the way the cmdlet runs or supply additional information to the cmdlet.
For example, to get the list of Stirling-specific cmdlets installed in the PowerShell environment, you use the same cmdlet mentioned previously, Get-Command. However, this time you must restrict the returned list of cmdlets to those that are provided by the Stirling snap-in. To get the list of cmdlets provided by the Stirling snap-in, type the following in a PowerShell console on the Stirling server:
Get-Command -pSSnapin ffspssnapin
The output is a list of the cmdlets available in the Stirling snap-in (ffspssnapin).