### Install Beta/Prerelease Pure Storage PowerShell SDK 2 Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/release_notes.md Install a beta or prerelease version of the PowerShell SDK version 2. This is not recommended for production environments. ```powershell Install-Module -Name PureStoragePowerShellSDK2 -AllowPrerelease -Force ``` -------------------------------- ### Install Pure Storage PowerShell SDK v2 Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/README.md Installs the Pure Storage PowerShell SDK version 2 from the PowerShell Gallery. Note that the MSI installer has been deprecated. ```powershell Install-Module -Name PureStoragePowerShellSDK2 ``` -------------------------------- ### Get Help for a Specific Cmdlet Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/release_notes.md Retrieve help information for a specific cmdlet, such as Get-Pfa2Volume. ```powershell Get-Help -Name Get-Pfa2Volume ``` -------------------------------- ### Get Volumes from Offset Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Retrieve volumes starting from a specified offset using the `-Offset` option. Useful for fetching subsequent pages of results. ```powershell $RemainingVolumes = Get-Pfa2Volume -Array $Array -Offset $Limit ``` -------------------------------- ### Get Limited Set of Volumes Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Retrieve a specific number of volumes using the `-Limit` option. This is often used in conjunction with `-Offset` for pagination. ```powershell $Volumes = Get-Pfa2Volume -Array $Array -Limit $Limit ``` -------------------------------- ### Get Array-Wide SafeMode Status Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Safemode.help.txt Retrieves the Array-Wide SafeMode status, which indicates manual eradication status applied at the array level. The status is reflected in the EradicationConfig property. ```powershell (Get-Pfa2Array).EradicationConfig ``` -------------------------------- ### Get Object-Level SafeMode Status Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Safemode.help.txt Retrieves the Object-Level SafeMode status for a specific protection group. This status applies to the protection group level. Note that if either Array-Wide or Object-Level SafeMode is enabled, the status will be 'enabled'. ```powershell (Get-Pfa2ProtectionGroup -Name "testpg").EradicationConfig ``` -------------------------------- ### Download Cmdlet Help Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/release_notes.md Download the detailed help information for the Pure Storage PowerShell SDK 2 cmdlets. ```powershell Update-Help -Module PureStoragePowerShellSDK2 ``` -------------------------------- ### Locate and Open Configuration File Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Filtering.help.txt Demonstrates how to find the location of the App.Config.JSON file and open it with Notepad. This is useful for manual configuration edits. ```powershell PS C:\> Import-Module PureStoragePowerShellSDK2 PS C:\> Get-Module PureStoragePowerShellSDK2 | Select-Object Name, Path | Format-List Name : PureStoragePowerShellSDK2 Path : C:\Program Files\WindowsPowerShell\Modules\PureStoragePowerShellSDK2\PureStoragePowerShellSDK2.dll PS C:\> Notepad "C:\Program Files\WindowsPowerShell\Modules\PureStoragePowerShellSDK2\App.Config.JSON" ``` -------------------------------- ### All Supported Options with Defaults Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Filtering.help.txt Specifies all supported configuration options with their default values. This can be used as a template for comprehensive configuration. ```json { "PureRest.HttpTimeoutInMilliseconds": "30000", "PureRest.NoOfRetries": 3, "PureRest.RetryIntervalBase": 100, "PureRest.RetryIntervalGrowthFactor": 3, "PureRest.SshPublicKeyResponseTimeoutInMilliseconds": 1000, "PureRest.SshPublicKeyTimeoutInMilliseconds": 5000, "PureRest.SshPublicKeyWriteTimeoutInMilliseconds": 5 } ``` -------------------------------- ### Create API Client with Existing RSA Key Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Use this command when you have an existing RSA key pair and need to register a new API client on the FlashArray. Ensure you are already authenticated with the array. ```powershell $ApiClient = New-Pfa2ApiClient -Array $Array -MaxRole $MaxRole -Issuer $ArrayIssuer -PublicKey $Certificate -Name $ClientName ``` -------------------------------- ### Find Available About Topics Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/release_notes.md Discover the available 'About' topics related to the Pure Storage PowerShell SDK 2 cmdlets. ```powershell Get-Help -Name About_Pfa2* ``` -------------------------------- ### Generate Key Pair and Create API Client Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md This command generates a new RSA key pair, stores it locally, and creates a new API client on the FlashArray. It's useful when you don't have an existing key pair. If the API client already exists, it returns the existing client. ```powershell $ApiClientAuthInfo = New-Pfa2ArrayAuth -Endpoint $ArrayEndpoint -ApiClientName $Clientname -Issuer $ArrayIssuer -Username $ArrayUsername -Password $ArrayPassword -Force ``` -------------------------------- ### Sort Volumes by Name then Provisioned Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Apply multi-level sorting to volumes by providing a comma-separated list of sort keys. ```powershell $Result = Get-Pfa2Volume -Array $Array -Sort "name,provisioned" ``` -------------------------------- ### Enable API Client Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md After creating an API client with `New-Pfa2ApiClient`, use this command to enable it. The API client is disabled by default upon creation. ```powershell Update-Pfa2ApiClient -Array $Array -Name $ClientName -Enabled $true ``` -------------------------------- ### Establish OAUTH2 Session Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Connects to the FlashArray using OAUTH2 authentication. This command requires details about the API client, including its ID, key ID, and private key file, along with array endpoint and issuer information. ```powershell $oauth = Connect-Pfa2Array -Endpoint $ArrayEndpoint -Username $ArrayUsername -Issuer $ArrayIssuer -ApiClientName $Clientname -ClientId $clientId -KeyId $keyId -PrivateKeyFile $privateKeyFile -PrivateKeyPassword $privateKeyPassword -IgnoreCertificateError ``` -------------------------------- ### Connect to FlashArray using API Token Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Use this command to establish a PowerShell session with your FlashArray via API token. You must define the FlashArray endpoint and will be prompted for FlashArray credentials. ```powershell $Array = Connect-Pfa2Array -Endpoint $ArrayEndpoint -Credential (Get-Credential) -IgnoreCertificateError ``` -------------------------------- ### Set Local Logging File Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Configure detailed SDK operation logging to a specified file using `Set-Pfa2Logging`. Set `-LogFilename` to an empty string to stop logging. ```powershell Set-Pfa2Logging -LogFilename "C:\path\to\sdk.log" ``` ```powershell Set-Pfa2Logging -LogFilename "" ``` -------------------------------- ### Retrieve API Client Credentials (New-Pfa2ApiClient) Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Retrieves the client ID and key ID from the response of the `New-Pfa2ApiClient` command. You will also need to specify the path to your private key file separately. ```powershell $clientId = $ApiClient.Id $keyId = $ApiClient.KeyId ``` -------------------------------- ### Enable Local Verbose Logging Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Enable detailed logging to the PowerShell Verbose stream (stream 4) for any *-Pfa2 Cmdlet by adding the `-Verbose` option. ```powershell # Example usage with -Verbose flag Get-Pfa2Volume -Array $Array -Verbose ``` -------------------------------- ### Retrieve API Client Credentials (New-Pfa2ArrayAuth) Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Extracts the client ID, key ID, and private key file path from the output of the `New-Pfa2ArrayAuth` command, which are necessary for establishing an OAUTH2 session. ```powershell $clientId = $ApiClientAuthInfo.PureClientApiClientInfo.clientId $keyId = $ApiClientAuthInfo.PureClientApiClientInfo.KeyId $privateKeyFile = $ApiClientAuthInfo.pureCertInfo.privateKeyFile ``` -------------------------------- ### Create Volume with Default Protection Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Safemode.help.txt Creates a new volume and places it into the default protection group, assuming Auto-On SafeMode is enabled. This is relevant for arrays running Purity 6.3.4 and higher. ```powershell New-Pfa2Volume -Name "testpg" -Provisioned 10gb ``` -------------------------------- ### Remove All Hosts using PowerShell Pipeline Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Use the pipeline to efficiently remove all hosts from a FlashArray. Ensure the array object is correctly defined. ```powershell Get-Pfa2Host -Array $Array | Remove-Pfa2Host -Array $Array ``` -------------------------------- ### Execute SSH CLI Commands via PowerShell Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Use `Invoke-Pfa2CLICommand` to run arbitrary CLI commands on a FlashArray over SSH. Securely handle passwords and specify the command text. ```powershell $Password = ConvertTo-SecureString -String $ArrayPassword -AsPlainText -Force $CommandText = "purevol create --size 10G test-volume-name" Invoke-Pfa2CLICommand -EndPoint $ArrayEndpoint -Username $ArrayUsername -Password $Password -CommandText $CommandText ``` -------------------------------- ### Update-Pfa2Host Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates host configurations, including CHAP settings and preferred array assignments. ```APIDOC ## Update-Pfa2Host ### Description Updates host configurations, including CHAP settings and preferred array assignments. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **Chap Parameters:** - **ChapHostPassword** (String) - Optional - Password for the CHAP host. - **ChapHostUser** (String) - Optional - Username for the CHAP host. - **ChapTargetPassword** (String) - Optional - Password for the CHAP target. - **ChapTargetUser** (String) - Optional - Username for the CHAP target. **PreferredArrays Parameters:** - **PreferredArraysId** (List) - Optional - List of preferred array IDs. - **PreferredArraysName** (List) - Optional - List of preferred array names. ``` -------------------------------- ### Sort Volumes by Name (Ascending) Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Sort the list of volumes by their name in ascending order using the `-Sort` option. ```powershell $Result = Get-Pfa2Volume -Array $Array -Sort "name" ``` -------------------------------- ### Update Pure Storage PowerShell SDK 2 Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/release_notes.md Perform this action to update the Pure Storage PowerShell SDK 2 module to the latest available version. ```powershell Update-Module -Name PureStoragePowerShellSDK2 ``` -------------------------------- ### Update-Pfa2Volume Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates volume configurations, including pod association and Quality of Service (QoS) settings. ```APIDOC ## Update-Pfa2Volume ### Description Updates volume configurations, including pod association and Quality of Service (QoS) settings. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **Pod Parameters:** - **PodId** (String) - Optional - The ID of the pod to associate the volume with. - **PodName** (String) - Optional - The name of the pod to associate the volume with. **Qos Parameters:** - **QosBandwidthLimit** (Object) - Optional - Sets the bandwidth limit for the volume. - **QosBandwidthLimitReset** (SwitchParameter) - Optional - Resets the bandwidth limit for the volume. - **QosIopsLimit** (Object) - Optional - Sets the IOPS limit for the volume. - **QosIopsLimitReset** (SwitchParameter) - Optional - Resets the IOPS limit for the volume. ``` -------------------------------- ### Update-Pfa2DirectoryService Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates the directory service configuration for a PFA2 object. Allows specifying management user attributes. ```APIDOC ## Update-Pfa2DirectoryService ### Description Updates the directory service configuration for a PFA2 object. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **ManagementUserLoginAttribute** (String) - Optional - Specifies the login attribute for the management user. - **ManagementUserObjectClass** (String) - Optional - Specifies the object class for the management user. ``` -------------------------------- ### Update-Pfa2Pod Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates pod configurations, specifically the failover preferences. ```APIDOC ## Update-Pfa2Pod ### Description Updates pod configurations, specifically the failover preferences. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **FailoverPreferences Parameters:** - **FailoverPreferencesId** (List) - Optional - List of failover preference IDs. - **FailoverPreferencesName** (List) - Optional - List of failover preference names. ``` -------------------------------- ### Set HTTP Timeout Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Filtering.help.txt Sets the default HTTP request timeout to 60 seconds. This configuration is applied globally. ```json { "PureRest.HttpTimeoutInMilliseconds": "60000" } ``` -------------------------------- ### Remove Pure Storage PowerShell SDK 2 Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/release_notes.md Execute this command to remove the Pure Storage PowerShell SDK 2 module from your system. ```powershell Remove-Module -Name PureStoragePowerShellSDK2 ``` -------------------------------- ### Sort Volumes by Name (Descending) Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Sort the list of volumes by their name in descending order by appending a hyphen to the sort key. ```powershell $Result = Get-Pfa2Volume -Array $Array -Sort "name-" ``` -------------------------------- ### Disable FlashArray Phonehome Logging Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Disable verbose logging to the FlashArray's external_rest.log by using the `-DisableVerbosePhoneHomeLogging` flag during array connection. ```powershell $Array = Connect-Pfa2Array -Endpoint $ArrayName -Credential (Get-Credential) -DisableVerbosePhoneHomeLogging ``` -------------------------------- ### Enable Object-Level SafeMode Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/about_Pfa2Safemode.help.txt Enables Object-Level SafeMode for a protection group by setting the retention lock. The retention lock can be set to 'ratcheted' or 'unlocked'. Disabling Object-Level SafeMode is not supported via the SDK. ```powershell Update-Pfa2ProtectionGroup -Name "testpg" -RetentionLock "ratcheted" ``` -------------------------------- ### Update-Pfa2ProtectionGroup Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates protection group settings, including replication schedule blackout periods, snapshot schedules, and retention policies. ```APIDOC ## Update-Pfa2ProtectionGroup ### Description Updates protection group settings, including replication schedule blackout periods, snapshot schedules, and retention policies. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **ReplicationScheduleBlackout Parameters:** - **ReplicationScheduleBlackoutEnd** (Int64) - Optional - End time for the replication schedule blackout period. - **ReplicationScheduleBlackoutStart** (Int64) - Optional - Start time for the replication schedule blackout period. **SnapshotSchedule Parameters:** - **SnapshotScheduleAt** (Int64) - Optional - Time for the snapshot schedule. - **SnapshotScheduleEnabled** (Boolean) - Optional - Enables or disables the snapshot schedule. - **SnapshotScheduleFrequency** (Int64) - Optional - Frequency of the snapshot schedule. **SourceRetention Parameters:** - **SourceRetentionAllForSec** (Int32) - Optional - Retention for all seconds for the source. - **SourceRetentionDays** (Int32) - Optional - Retention in days for the source. - **SourceRetentionPerDay** (Int32) - Optional - Retention per day for the source. **TargetRetention Parameters:** - **TargetRetentionAllForSec** (Int32) - Optional - Retention for all seconds for the target. - **TargetRetentionDays** (Int32) - Optional - Retention in days for the target. - **TargetRetentionPerDay** (Int32) - Optional - Retention per day for the target. ``` -------------------------------- ### Update-Pfa2VolumeGroup Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates volume group configurations, specifically Quality of Service (QoS) settings. ```APIDOC ## Update-Pfa2VolumeGroup ### Description Updates volume group configurations, specifically Quality of Service (QoS) settings. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **Qos Parameters:** - **QosBandwidthLimit** (Object) - Optional - Sets the bandwidth limit for the volume group. - **QosBandwidthLimitReset** (SwitchParameter) - Optional - Resets the bandwidth limit for the volume group. - **QosIopsLimit** (Object) - Optional - Sets the IOPS limit for the volume group. - **QosIopsLimitReset** (SwitchParameter) - Optional - Resets the IOPS limit for the volume group. ``` -------------------------------- ### Update-Pfa2RemoteProtectionGroup Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/About_Pfa2ReferenceParameters.help.txt Updates the target retention settings for a remote protection group. ```APIDOC ## Update-Pfa2RemoteProtectionGroup ### Description Updates the target retention settings for a remote protection group. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **TargetRetention Parameters:** - **TargetRetentionAllForSec** (Int32) - Optional - Retention for all seconds for the target. - **TargetRetentionDays** (Int32) - Optional - Retention in days for the target. - **TargetRetentionPerDay** (Int32) - Optional - Retention per day for the target. ``` -------------------------------- ### Remove Hosts Containing 'test' using PowerShell Pipeline Source: https://github.com/purestorage-connect/powershellsdk2/blob/main/quick_tips.md Filter hosts by name using `Where-Object` within the pipeline before removing them. This allows for targeted host removal. ```powershell (Get-Pfa2host -Array $Array) | Where-Object {$_.name -like '*test*'} | Remove-Pfa2Host -Array $Array ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.