@@ -31,60 +31,60 @@ Get-Help New-PfaArray -Examples
31
31
$Creds = Get-Credential
32
32
$fa = New-PfaArray - EndPoint 192.0 .0.1 - Credentials $Creds - IgnoreCertificateError
33
33
Get-PfaControllers - Array $fa
34
- $Controllers = Get-PfaControllers – Array $fa
34
+ $Controllers = Get-PfaControllers - Array $fa
35
35
$Controllers
36
36
37
37
# # Working with Volumes
38
38
# ######################
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 "
43
43
44
44
# # Volume and Host Connections
45
45
# #############################
46
46
$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 "
51
51
52
52
# # FlashRecover Snapshots
53
53
# ########################
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
57
57
58
58
# # Protection Groups
59
59
# ###################
60
- New-PfaProtectionGroup - Array $fa - Name ‘ SDKv1-PGROUP ’
60
+ New-PfaProtectionGroup - Array $fa - Name " sdk-pgroup "
61
61
$Volumes = @ ()
62
- ForEach ($i in 1 .. 10 ) { $Volumes += @ (" SDKv1-VOL $i " ) }
62
+ ForEach ($i in 1 .. 10 ) { $Volumes += @ (" sdk-vol $i " ) }
63
63
$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 "
70
70
71
71
$Volumes = @ ()
72
- ForEach ($i in 1 .. 10 ) { $Volumes += @ (" SDKv1-VOL $i " ) }
72
+ ForEach ($i in 1 .. 10 ) { $Volumes += @ (" sdk-vol $i " ) }
73
73
$Volumes
74
- Remove-PfaVolumesFromProtectionGroup - Array $fa - VolumesToRemove $Volumes - Name ' SDKv1-PGROUP '
74
+ Remove-PfaVolumesFromProtectionGroup - Array $fa - VolumesToRemove $Volumes - Name " sdk-pgroup "
75
75
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 "
79
79
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 "
82
82
83
83
# # Monitor Metrics
84
84
# #################
85
85
Get-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"
88
88
89
89
# # END QUICK START EXAMPLES
90
90
@@ -101,8 +101,8 @@ New-PfaCliCommand -EndPoint 192.0.0.1 -UserName $Username -Password $SecurePassw
101
101
102
102
# # EXAMPLE
103
103
# 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
106
106
107
107
# # EXAMPLE
108
108
# 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
116
116
# # EXAMPLE
117
117
# Get volumes created within the last 30 days
118
118
$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 ) }
120
120
121
121
# # EXAMPLE
122
122
# Destroy (not eradicate) snapshots older than "x" Days for all volumes
@@ -150,7 +150,7 @@ Param (
150
150
}
151
151
152
152
# # 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"
154
154
$fa = New-PfaArray - EndPoint 192.0 .0.1 - Username pureuser - IgnoreCertificateError
155
155
$purevolume = " vol1"
156
156
# Set number of days from today to retain
@@ -188,6 +188,26 @@ foreach ($pg in $pgs) {
188
188
Get-PfaProtectionGroupSnapshots - Array $fa - Name $pg.name | Select-Object Name, created | Format-Table - AutoSize
189
189
}
190
190
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
+
191
211
# # EXAMPLE
192
212
# Configure syslog server on multiple arrays
193
213
$cred = Get-Credential
@@ -241,14 +261,14 @@ New-PfaReplicationConnection -Array $sourceArray -ManagementAddress 192.0.0.1 -r
241
261
old_password = $OldPassword ;
242
262
}
243
263
$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
245
265
<# Get and Return Updated User #>
246
266
$user = Invoke-WebRequest - Uri $adminURI - Method Get - WebSession $pure - UseBasicParsing
247
267
return ConvertFrom-Json ($user )
248
268
}
249
269
<# Example Usage of the Update-UserFaPassword Function #>
250
270
$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"
252
272
253
273
254
274
# ## END EXAMPLES FILE
0 commit comments