Pure Storge PowerShell Toolkit Enhancements

@8arkz – September 11/17 — The “Original” version of the PowerShell Toolkit v2.8.0.430 has been deprecated in favor of the PowerShell SDK. Read all about it here.

Lots of updates!


New Session Management

Previous version called Connect and Disconnect methods on every call. I took this approach to simplify end user implementation. This was a bad model based on the number of identical calls and more importantly did not allow for multi-array session management. Using a single PowerShell session multi-arrays can be managed now. The example below shows how two different FlashArrays can be connected and tasks submitted by using the different $MySession variables.

$FlashArray1 = ""
$FlashArray2 = ""
$MyToken = Get-PfaAPIToken -FlashArray $FlashArray1 -Username USERNAME-Password PASSWORD
$MyToken1 = Get-PfaAPIToken -FlashArray $FlashArray2 -Username USERNAME-Password PASSWORD
$MySession = Connect-PfaController -FlashArray $FlashArray1 -APIToken $MyToken.api_token
$Session1 = Connect-PfaController -FlashArray $FlashArray2 -APIToken $MyToken1.api_token
Disconnect-PfaController -FlashArray $FlashArray1 -Session $MySession
Disconnect-PfaController -FlashArray $FlashArray2 -Session $Session1

The end user is now responsible for connecting and disconnecting from the individual sessions.

New cmdlet functions added:


Description: Retrieve ports on the FlashArray. Example results.

iqn wwn portal name 
--- --- ------ ---- 
 524A9379A9BBA100 CT0.FC0
 524A9379A9BBA101 CT0.FC1
 524A9379A9BBA102 CT0.FC2
 524A9379A9BBA103 CT0.FC3


Get-PfaPorts -FlashArray $FlashArray1 -Session $MySession | Where-Object { $_.name -like "CT0.*" } | Format-Table -Autosize


Description: Retrieve all of the initiators connected to the FlashArray. Example return.

target wwn target_wwn 
------ --- ---------- 
CT0.FC0 21000024FF327E24 524A9379A9BBA100
CT0.FC2 21000024FF327E24 524A9379A9BBA102
CT1.FC0 21000024FF327E24 524A9379A9BBA110
CT1.FC2 21000024FF327E24 524A9379A9BBA112
CT0.FC1 21000024FF327E25 524A9379A9BBA101
CT0.FC3 21000024FF327E25 524A9379A9BBA103
CT1.FC1 21000024FF327E25 524A9379A9BBA111
CT1.FC3 21000024FF327E25 524A9379A9BBA113


Get-PfaInitiators -FlashArray $FlashArray1 -Session $MySession | Where-Object { $_.wwn -like "210000*" } | Select target, wwn, target_wwn | Format-Table -Autosize


Description: Used to retrieve details about the specific host group. Using this cmdlet will provide results similiar to the below example.

total : 137076666368
name : HG1
snapshots : 0
volumes : 137076666368
data_reduction : 3.27806364670009
size : 10995116277760
thin_provisioning : 0.9309829900174009
total_reduction : 47.4964598948371


Get-PfaHostGroupSpace -FlashArray $FlashArray1 -GroupName HG1 -Session $MySession


Description: Retrieve information about an existing host group.


Get-PfaHostGroup -FlashArray $FlashArray1 -GroupName HG1 -Session $MySession


Description: Use to connect a volume to a host group.


Connect-PfaHostGroup -FlashArray $FlashArray1 -HostGroupName HG1 -Volume TEST-VOL -Session $MySession


Description: Easy cmdlet to open the GitHub repository for the toolkit, will use your default browser.




Description: As part of taking snapshots and creating new volumes from those snapshots we provide a mechanism to refresh a volume, in REST API terms we call it overwrite. Using this cmdlet will take an existing volume that was created from a snapshot and refresh the underlying volume with the latest source data.


Refresh-PfaVolume -FlashArray $FlashArray1 -Name SQL_DATA3_DEVTEST -Source SQL_DATA3 -Session $MySession


Description: This function was created mostly for my dev/test procedures while developing the toolkit. On a Pure Storage FlashArray an administrator can destroy a volume which goes into what I call our volume recycle bin for 24 hours. After 24hrs the volume is eradicated from the system. A nice feature for those “oh crap I deleted volume/snapshot X”. Using this cmdlet is immediately destructive to a volume.


Eradicate-PfaVolume -FlashArray $FlashArray1 -Volume TEST-VOL$i-$Station -Session $MySession

Latest v2.8.0.430 can be downloaded from https://github.com/PureStorage-OpenConnect/powershell-toolkit-

Big shout out to ‘Master of the Hat’ for sending feedback and putting the toolkit through some great testing in a real-world proof-of-concept environment.

As always hit me up https://twitter.com/8arkz or barkz@purestorage.com with questions/comments.

Add Comment

Required fields are marked *. Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.