Pure Storge PowerShell Toolkit Enhancements

Lots of updates since forking the repository over to http://github.com/barkz/PureStoragePowerShellToolkit https://github.com/purestorage/PowerShell-Toolkit.

Enhancements

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 = "0.0.0.0"
$FlashArray2 = "0.0.0.1"
$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:

Get-PfaPorts

Description: Retrieve ports on the FlashArray. Example results.

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

Example

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

Get-PfaInitiators

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

Example

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

Get-PfaHostGroupSpace

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

Example

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

Get-PfaHostGroup

Description: Retrieve information about an existing host group.

Example

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

Connect-PfaHostGroup

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

Example

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

Open-PureStorageGitHub

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

Example

Open-PureStorageGitHub

Refresh-PfaVolume

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.

Example

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

Eradicate-PfaVolume

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.

Example

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

Latest v2.8.0.430 v1.1.2-Beta can be downloaded from https://github.com/barkz/PureStoragePowerShellToolkit https://github.com/purestorage/PowerShell-Toolkit/releases/tag/v1.1.2-Beta. If there are questions, comments, issues, etc. please use the Issues list at https://github.com/barkz/PureStoragePowerShellToolkit/issues https://github.com/purestorage/PowerShell-Toolkit/issues.

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 @themsftdude (Twitter) or @ barkz@purestorage.com with questions/comments.