How-To: Installing the FlashArray PowerShell SDK using the PowerShell Gallery
This article applies to all versions of the PowerShell SDK.
This article contains information on installing the PowerShell SDK version 1 and version 2. Each version has its own package in the PowerShell gallery and must be installed using a different package name - PureStoragePowerShellSDK for version 1, and PureStoragePowerShellSDK2 for version 2. Both packages will continue to remain until such time that version 1 is deprecated.
Starting with the PowerShell SDK version 1.5.5.x, the Pure Storage PowerShell module can be installed from the PowerShell Gallery. Installing from the PowerShell Gallery allows for quicker updates, no installation package downloads (i.e MSI), and it can be deployed across a data center quickly via automation to individual server nodes.
Starting with Windows PowerShell 5.0, the PowerShellGet module was included in the base PowerShell package from Microsoft. The PowerShellGet module provides the integration with the PowerShell Gallery for remotely installing additional modules.
See Update-Module for easy updating when a new version is released.
If the module is installed using the MSI installer, by default, the module will be installed to the \Program Files\Pure Storage\PowerShell\Modules folder. This is configurable during the installation. When the module is installed using the PowerShell Gallery and the Install-Module
cmdlet, the module is installed in the default $PSModulePath.
SDK Version 2 Installation
Installation Steps
- Visit Getting Started with the PowerShell Gallery to understand the requirements and setup required for using PowerShellGet. After configuring Windows PowerShell to support installing from the PowerShell Gallery, we are ready to proceed with setup of the Pure Storage PowerShell SDK.
- Open a Windows PowerShell with Run as Administrator.
- Install the Pure Storage PowerShell SDK using the
Install
-Module
cmdlet. The latest version of the package is installed by default.
Install-Module -Name PureStoragePowerShellSDK2
Please note the name of the module is PureStoragePowerShellSDK2.
- Once the above cmdlet is executed, you will see the below warning if the PowerShell Gallery (i.e. PSGallery) has not been setup as a Trusted Repository.
PS C:\> Install-Module -Name PureStoragePowerShellSDK2 Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
- Choose [N] No to exit and set the PSGallery repository to Trusted in order to avoid this issue in the future.
PS C:\> Get-PSRepository Name InstallationPolicy SourceLocation ---- ------------------ -------------- PSGallery Untrusted https://www.powershellgallery.com/api/v2/ PS C:\> Set-PSRepository -Name PSGallery -InstallationPolicy Trusted PS C:\> Get-PSRepository Name InstallationPolicy SourceLocation ---- ------------------ -------------- PSGallery Trusted https://www.powershellgallery.com/api/v2/ PS C:\>
- Re-run the below command to install. Depending on your connection speed, the download and installation could take a moment. When the installation starts, a Windows PowerShell status notification will display in the session window.
Install-Module -Name PureStoragePowerShellSDK2
If a previous version of the PowerShell SDK has been installed via the PowerShell Gallery, use the cmdlet Update-Module -Name PureStoragePowerShellSDK
to get the latest version.
- After installing the SDK, check that it was installed using the command below. This will return a list of all available scripts and binaries.
PS C:\> Get-Module -ListAvailable Directory: C:\Program Files\WindowsPowerShell\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...} Script 1.2 PSReadline {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-... Binary 2.2.272.0 PureStoragePowerShellSDK2 {Connect-Pfa2Aarray, Get-Pfa2Array, Get-Pfa2Alert...}
- After installation has completed and verified, the PowerShell SDK is ready for use. To see what cmdlets are available, use the command below:
PS C:\> Get-Command -Module PureStoragePowerShellSDK2 | more CommandType Name Version Source ----------- ---- ------- ------ CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Connect-Pfa2Array 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Disconnect-Pfa2Array 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2Admin 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2AdminApiToken 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2AdminCache 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2AdminSetting 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2Alert 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2AlertEvent 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2ApiClient 2.2.272.0 PureStoragePowerShellSDK2 Cmdlet Get-Pfa2ApiVersion 2.2.272.0 PureStoragePowerShellSDK2 -- More --
SDK Version 1 Installation
Installation Steps
- Visit Getting Started with the PowerShell Gallery to understand the requirements and setup required for using PowerShellGet. After configuring Windows PowerShell to support installing from the PowerShell Gallery, we are ready to proceed with setup of the Pure Storage PowerShell SDK.
- Open a Windows PowerShell with Run as Administrator.
- Install the Pure Storage PowerShell SDK using the
Install
-Module
cmdlet. The latest version of the package is installed by default.
Install-Module -Name PureStoragePowerShellSDK
Please note the name of the module is PureStoragePowerShellSDK.
- Once the above cmdlet is executed, you will see the below warning if the PowerShell Gallery (i.e. PSGallery) has not been setup as a Trusted Repository.
PS C:\> Install-Module -Name PureStoragePowerShellSDK Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
- Choose [N] No to exit and set the PSGallery repository to Trusted in order to avoid this issue in the future.
PS C:\> Get-PSRepository Name InstallationPolicy SourceLocation ---- ------------------ -------------- PSGallery Untrusted https://www.powershellgallery.com/api/v2/ PS C:\> Set-PSRepository -Name PSGallery -InstallationPolicy Trusted PS C:\> Get-PSRepository Name InstallationPolicy SourceLocation ---- ------------------ -------------- PSGallery Trusted https://www.powershellgallery.com/api/v2/ PS C:\>
- Re-run the below command to install. Depending on your connection speed, the download and installation could take a moment. When the installation starts, a Windows PowerShell status notification will display in the session window.
Install-Module -Name PureStoragePowerShellSDK
If a previous version of the PowerShell SDK has been installed via the PowerShell Gallery, use the cmdlet Update-Module -Name PureStoragePowerShellSDK
to get the latest version.
- After installing the SDK, check that it was installed using the command below. This will return a list of all available scripts and binaries.
PS C:\> Get-Module -ListAvailable Directory: C:\Program Files\WindowsPowerShell\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...} Script 1.2 PSReadline {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-... Binary 1.6.6.0 PureStoragePowerShellSDK {Disable-PfaAlert, Enable-PfaAlert, Get-PfaAlert, Get-PfaAlerts...}
- After installation has completed and verified, the PowerShell SDK is ready for use. To see what cmdlets are available, use the command below:
PS C:\> Get-Command -Module PureStoragePowerShellSDK | more CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Add-PfaHostGroupsToProtectionGroup 1.17.3.0 PureStoragePowerShellSDK Cmdlet Add-PfaHostIqns 1.17.3.0 PureStoragePowerShellSDK Cmdlet Add-PfaHosts 1.17.3.0 PureStoragePowerShellSDK Cmdlet Add-PfaHostsToProtectionGroup 1.17.3.0 PureStoragePowerShellSDK Cmdlet Add-PfaHostWwns 1.17.3.0 PureStoragePowerShellSDK Cmdlet Add-PfaSlaveInterfaces 1.17.3.0 PureStoragePowerShellSDK Cmdlet Add-PfaTargetArrays 1.17.3.0 PureStoragePowerShellSDK -- More --