@@ -31,60 +31,60 @@ Get-Help New-PfaArray -Examples
3131$Creds = Get-Credential
3232$fa = New-PfaArray - EndPoint 192.0 .0.1 - Credentials $Creds - IgnoreCertificateError
3333Get-PfaControllers - Array $fa
34- $Controllers = Get-PfaControllers – Array $fa
34+ $Controllers = Get-PfaControllers - Array $fa
3535$Controllers
3636
3737# # Working with Volumes
3838# ######################
39- New-PfaVolume – Array $fa – VolumeName ' SDKv1-VOL ' – Unit ' TB ' – Size 2
40- ForEach ($i in 2 .. 10 ) { New-PfaVolume – Array $fa – VolumeName “ SDKv1-VOL $i ” – Unit TB – Size 2 }
41- Get-PfaVolume – Array $fa – Name ‘ SDKv1-VOL ’ | Format-Table – Autosize
42- Rename-PfaVolumeOrSnapshot – Array $fa – NewName ‘ SDKv1-VOL1 ’ – Name ‘ SDKv1-VOL ’
39+ New-PfaVolume - Array $fa - VolumeName " sdk-vol " - Unit " TB " - Size 2
40+ ForEach ($i in 2 .. 10 ) { New-PfaVolume - Array $fa - VolumeName “ sdk-vol $i ” - Unit TB - Size 2 }
41+ Get-PfaVolume - Array $fa - Name " sdk-vol " | Format-Table - Autosize
42+ Rename-PfaVolumeOrSnapshot - Array $fa - NewName " sdk-vol1 " - Name " sdk-vol "
4343
4444# # Volume and Host Connections
4545# #############################
4646$wwn = @ (' 10:00:00:00:00:00:11:11' , ' 10:00:00:00:00:00:12:12' )
47- New-PfaHost – Array $fa – Name ‘ SDKv1-HOST1 ’ – WwnList $wwn
48- New-PfaHostGroup - Array $fa - Hosts ' SDKv1-HOST1 ' - Name ' SDKv1-HOSTGROUP '
49- New-PfaHostVolumeConnection - Array $fa - VolumeName ' SDKv1-VOL1 ' - HostName ' SDKv1-HOST1 '
50- New-PfaHostGroupVolumeConnection - Array $fa - VolumeName ' SDKv1-VOL2 ' - HostGroupName ' SDKv1-HOSTGROUP '
47+ New-PfaHost - Array $fa - Name " sdk-host1 " - WwnList $wwn
48+ New-PfaHostGroup - Array $fa - Hosts " sdk-host1 " - Name " sdk-hostgroup "
49+ New-PfaHostVolumeConnection - Array $fa - VolumeName " sdk-vol1 " - HostName " sdk-host1 "
50+ New-PfaHostGroupVolumeConnection - Array $fa - VolumeName " sdk-vol2 " - HostGroupName " sdk-hostgroup "
5151
5252# # FlashRecover Snapshots
5353# ########################
54- New-PfaVolumeSnapshots - Array $fa - Sources ' SDKv1-VOL1 ' , ' SDKv1-VOL2 ' - Suffix ' EXAMPLE'
55- New-PfaVolume - Array $fa - Source ' SDKv1-VOL1 .EXAMPLE' - VolumeName ' NEW-SDKv1-VOL1 '
56- New-PfaVolume - Array $fa - Source ' SDKv1-VOL2 .EXAMPLE' - VolumeName ' SDKv1-VOL2 ' – Overwrite
54+ New-PfaVolumeSnapshots - Array $fa - Sources " sdk-vol1 " , " sdk-vol2 " - Suffix " EXAMPLE"
55+ New-PfaVolume - Array $fa - Source " sdk-vol1 .EXAMPLE" - VolumeName " new-sdk-vol1 "
56+ New-PfaVolume - Array $fa - Source " sdk-vol2 .EXAMPLE" - VolumeName " sdk-vol2 " - Overwrite
5757
5858# # Protection Groups
5959# ###################
60- New-PfaProtectionGroup - Array $fa - Name ‘ SDKv1-PGROUP ’
60+ New-PfaProtectionGroup - Array $fa - Name " sdk-pgroup "
6161$Volumes = @ ()
62- ForEach ($i in 1 .. 10 ) { $Volumes += @ (" SDKv1-VOL $i " ) }
62+ ForEach ($i in 1 .. 10 ) { $Volumes += @ (" sdk-vol $i " ) }
6363$Volumes
64- Add-PfaVolumesToProtectionGroup - Array $fa - VolumesToAdd $Volumes - Name ' SDKv1-PGROUP '
65- New-PfaProtectionGroupSnapshot - Array $fa - Protectiongroupname ' SDKv1-PGROUP ' - Suffix ' EXAMPLE'
66- Get-PfaProtectionGroupSnapshots - Array $fa - Name ' SDKv1-PGROUP '
67- Get-PfaProtectionGroupSchedule - Array $fa - ProtectionGroupName ' SDKv1-PGROUP '
68- Set-PfaProtectionGroupSchedule - Array $fa - SnapshotFrequencyInSeconds 21600 - GroupName ' SDKv1-PGROUP '
69- Enable-PfaSnapshotSchedule - Array $fa - Name ' SDKv1-PGROUP '
64+ Add-PfaVolumesToProtectionGroup - Array $fa - VolumesToAdd $Volumes - Name " sdk-pgroup "
65+ New-PfaProtectionGroupSnapshot - Array $fa - Protectiongroupname " sdk-pgroup " - Suffix " EXAMPLE"
66+ Get-PfaProtectionGroupSnapshots - Array $fa - Name " sdk-pgroup "
67+ Get-PfaProtectionGroupSchedule - Array $fa - ProtectionGroupName " sdk-pgroup "
68+ Set-PfaProtectionGroupSchedule - Array $fa - SnapshotFrequencyInSeconds 21600 - GroupName " sdk-pgroup "
69+ Enable-PfaSnapshotSchedule - Array $fa - Name " sdk-pgroup "
7070
7171$Volumes = @ ()
72- ForEach ($i in 1 .. 10 ) { $Volumes += @ (" SDKv1-VOL $i " ) }
72+ ForEach ($i in 1 .. 10 ) { $Volumes += @ (" sdk-vol $i " ) }
7373$Volumes
74- Remove-PfaVolumesFromProtectionGroup - Array $fa - VolumesToRemove $Volumes - Name ' SDKv1-PGROUP '
74+ Remove-PfaVolumesFromProtectionGroup - Array $fa - VolumesToRemove $Volumes - Name " sdk-pgroup "
7575
76- Add-PfaHostsToProtectionGroup - Array $fa - Name ' SDKv1-PGROUP ' - HostsToAdd ' SDKv1-HOST1 '
77- New-PfaProtectionGroupSnapshot - Array $fa - Protectiongroupname ' SDKv1-PGROUP '
78- Remove-PfaHostsFromProtectionGroup - Array $fa - HostsToRemove ' SDKv1-HOST1 ' - Name ' SDKv1-PGROUP '
76+ Add-PfaHostsToProtectionGroup - Array $fa - Name " sdk-pgroup " - HostsToAdd " sdk-host1 "
77+ New-PfaProtectionGroupSnapshot - Array $fa - Protectiongroupname " sdk-pgroup "
78+ Remove-PfaHostsFromProtectionGroup - Array $fa - HostsToRemove " sdk-host1 " - Name " sdk-pgroup "
7979
80- Add-PfaHostGroupsToProtectionGroup - Array $fa - HostGroupsToAdd ' SDKv1-HOSTGROUP ' - Name ' SDKv1-PGROUP '
81- New-PfaProtectionGroupSnapshot - Array $fa - Protectiongroupname ' SDKv1-PGROUP '
80+ Add-PfaHostGroupsToProtectionGroup - Array $fa - HostGroupsToAdd " sdk-hostgroup " - Name " sdk-pgroup "
81+ New-PfaProtectionGroupSnapshot - Array $fa - Protectiongroupname " sdk-pgroup "
8282
8383# # Monitor Metrics
8484# #################
8585Get-Command - Module PureStoragePowerShellSDK * Metric
86- Get-PfaVolumeIOMetrics - Array $fa - VolumeName ‘ SDKv1-VOL1 ’ – TimeRange 1h | Format-Table – AutoSize
87- Get-PfaVolumeIOMetrics - Array $fa - VolumeName ‘ SDKv1-VOL1 ’ – TimeRange 1h | Export-Csv - Path ‘ C:\temp\test.csv’
86+ Get-PfaVolumeIOMetrics - Array $fa - VolumeName " sdk-vol1 " - TimeRange 1h | Format-Table - AutoSize
87+ Get-PfaVolumeIOMetrics - Array $fa - VolumeName " sdk-vol1 " - TimeRange 1h | Export-Csv - Path " C:\temp\test.csv"
8888
8989# # END QUICK START EXAMPLES
9090
@@ -101,8 +101,8 @@ New-PfaCliCommand -EndPoint 192.0.0.1 -UserName $Username -Password $SecurePassw
101101
102102# # EXAMPLE
103103# Alternative using Get-Credentials in-line
104- $CommandText = " purepgroup snap --replicate-now SDKv1-PGROUP "
105- New-PfaCliCommand - EndPoint 192.0 .0.1 - Credential (Get-Credential ) - IgnoreCertificateError - CommandText $CommandText
104+ $CommandText = " purepgroup snap --replicate-now sdk-pgroup "
105+ New-PfaCliCommand - EndPoint 192.0 .0.1 - Credential (Get-Credential ) - CommandText $CommandText
106106
107107# # EXAMPLE
108108# Create a PowerShell array of authenticated FlashArray objects and perform a command against all of the objects in series
@@ -116,7 +116,7 @@ Get-PfaVolumes -Array $fa
116116# # EXAMPLE
117117# Get volumes created within the last 30 days
118118$a = (Get-Date ).AddDays(-30 )
119- Get-PfaVolumes - Array $Array | Where-Object { ($_.name -like ' Volume0*' ) -and ($_.created -ge $a ) }
119+ Get-PfaVolumes - Array $Array | Where-Object { ($_.name -like " Volume0*" ) -and ($_.created -ge $a ) }
120120
121121# # EXAMPLE
122122# Destroy (not eradicate) snapshots older than "x" Days for all volumes
@@ -150,7 +150,7 @@ Param (
150150}
151151
152152# # EXAMPLE
153- # Alternative method for destroy (not eradicate) snapshots older than "x" days for volume ' vol1'
153+ # Alternative method for destroy (not eradicate) snapshots older than "x" days for volume " vol1"
154154$fa = New-PfaArray - EndPoint 192.0 .0.1 - Username pureuser - IgnoreCertificateError
155155 $purevolume = " vol1"
156156 # Set number of days from today to retain
@@ -188,6 +188,26 @@ foreach ($pg in $pgs) {
188188 Get-PfaProtectionGroupSnapshots - Array $fa - Name $pg.name | Select-Object Name, created | Format-Table - AutoSize
189189}
190190
191+ # # EXAMPLE
192+ # Invoke REST API command to retrieve volumes
193+ Invoke-PfaRestCommand - EndPoint 192.0 .0.1 - Method GET - Command " https://pure01.example.com/api/1.19/volume"
194+
195+ # # EXAMPLE
196+ # Invoke REST API command create a volume 10G in size on Array $array
197+ $command = " volume/sdk-vol1"
198+ $body = ' { "size": "10G" } '
199+ Invoke-PfaRestCommand - Array $fa - Method POST - Command $command - Body $body
200+
201+ # # EXAMPLE
202+ # Delete the volume created in the previous example
203+ $command = " volume/sdk-vol1"
204+ Invoke-PfaRestCommand - Array $fa - Method DELETE - Command $command
205+
206+ # # EXAMPLE
207+ # Eradicate the volume from the previous example
208+ $command = " volume/sdk-vol1?eradicate=true"
209+ Invoke-PfaRestCommand - Array $fa - Method DELETE - Command $command
210+
191211# # EXAMPLE
192212# Configure syslog server on multiple arrays
193213$cred = Get-Credential
@@ -241,14 +261,14 @@ New-PfaReplicationConnection -Array $sourceArray -ManagementAddress 192.0.0.1 -r
241261 old_password = $OldPassword ;
242262 }
243263 $body = $body | ConvertTo-Json
244- $result = Invoke-WebRequest - Uri $adminURI - WebSession $pure - Method Put - Body $body - ContentType ' application/json' - UseBasicParsing
264+ $result = Invoke-WebRequest - Uri $adminURI - WebSession $pure - Method Put - Body $body - ContentType " application/json" - UseBasicParsing
245265 <# Get and Return Updated User #>
246266 $user = Invoke-WebRequest - Uri $adminURI - Method Get - WebSession $pure - UseBasicParsing
247267 return ConvertFrom-Json ($user )
248268 }
249269 <# Example Usage of the Update-UserFaPassword Function #>
250270 $fa = New-PfaArray - EndPoint 192.0 .0.1 - Credentials (Get-Credential ) - IgnoreCertificateError
251- Update-UserFaPassword - Array $fa - User " user1" - OldPassword ' myoldpassword' - NewPassword ' mynewpassword'
271+ Update-UserFaPassword - Array $fa - User " user1" - OldPassword " myoldpassword" - NewPassword " mynewpassword"
252272
253273
254274# ## END EXAMPLES FILE
0 commit comments