This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathPureStoragePowerShellToolkit.psm1
4922 lines (4542 loc) · 244 KB
/
PureStoragePowerShellToolkit.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
===========================================================================
Release version: 2.0.4.0
Revision information: Refer to the changelog.md file
---------------------------------------------------------------------------
Maintained by: FlashArray Integrations and Evangelsigm Team @ Pure Storage
Organization: Pure Storage, Inc.
Filename: PureStoragePowerShellToolkit.psm1
Copyright: (c) 2022 Pure Storage, Inc.
Module Name: PureStoragePowerShellToolkit
Description: PowerShell Script Module (.psm1)
--------------------------------------------------------------------------
Disclaimer:
The sample module and documentation are provided AS IS and are not supported by the author or the author’s employer, unless otherwise agreed in writing. You bear
all risk relating to the use or performance of the sample script and documentation. The author and the author’s employer disclaim all express or implied warranties
(including, without limitation, any warranties of merchantability, title, infringement or fitness for a particular purpose). In no event shall the author, the author’s employer or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever arising out of the use or performance of the sample script and documentation (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss), even if such person has been advised of the possibility of such damages.
--------------------------------------------------------------------------
Contributors: Rob "Barkz" Barker @purestorage, Robert "Q" Quimbey @purestorage, Mike "Chief" Nelson, Julian "Doctor" Cates, Marcel Dussil @purestorage - https://en.pureflash.blog/ , Craig Dayton - https://github.com/cadayton , Jake Daniels - https://github.com/JakeDennis, Richard Raymond - https://github.com/data-sciences-corporation/PureStorage , The dbatools Team - https://dbatools.io , many more Puritans, and all of the Pure Code community who provide excellent advice, feedback, & scripts now and in the future.
===========================================================================
#>
#Requires -Version 3
#### BEGIN HELPER FUNCTIONS
#region ConvertTo-Base64
function ConvertTo-Base64() {
<#
.SYNOPSIS
Converts source file to Base64.
.DESCRIPTION
Helper function
Supporting function to handle conversions.
.INPUTS
Source (Mandatory)
.OUTPUTS
Converted source.
#>
Param (
[Parameter(Mandatory = $true)][String] $Source
)
return [Convert]::ToBase64String((Get-Content $Source -Encoding byte))
}
#endregion
#region Convert-Size
function Convert-Size() {
<#
.SYNOPSIS
Converts volume sizes from B to MB, MB, GB, TB.
.DESCRIPTION
Helper function
Supporting function to handle conversions.
.INPUTS
ConvertFrom (Mandatory)
ConvertTo (Mandatory)
Value (Mandatory)
Precision (Optional)
.OUTPUTS
Converted size of volume.
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)][ValidateSet("Bytes", "KB", "MB", "GB", "TB")][String]$ConvertFrom,
[Parameter(Mandatory = $true)][ValidateSet("Bytes", "KB", "MB", "GB", "TB")][String]$ConvertTo,
[Parameter(Mandatory = $true)][Double]$Value,
[Parameter(Mandatory = $false)][Int]$Precision = 4
)
switch ($ConvertFrom) {
"Bytes" { $value = $Value }
"KB" { $value = $Value * 1024 }
"MB" { $value = $Value * 1024 * 1024 }
"GB" { $value = $Value * 1024 * 1024 * 1024 }
"TB" { $value = $Value * 1024 * 1024 * 1024 * 1024 }
}
switch ($ConvertTo) {
"Bytes" { return $value }
"KB" { $Value = $Value / 1KB }
"MB" { $Value = $Value / 1MB }
"GB" { $Value = $Value / 1GB }
"TB" { $Value = $Value / 1TB }
}
return [Math]::Round($Value, $Precision, [MidPointRounding]::AwayFromZero)
}
#endregion
#region New-FlashArrayReportPieChart
function New-FlashArrayReportPieChart() {
<#
.SYNOPSIS
Creates graphic pie chart .png image file for use in report.
.DESCRIPTION
Helper function
Supporting function to create a pie chart.
.OUTPUTS
piechart.png.
#>
Param (
[string]$FileName,
[float]$SnapshotSpace,
[float]$VolumeSpace,
[float]$CapacitySpace
)
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization")
$chart = New-Object System.Windows.Forms.DataVisualization.charting.chart
$chart.Width = 700
$chart.Height = 500
$chart.Left = 10
$chart.Top = 10
$chartArea = New-Object System.Windows.Forms.DataVisualization.charting.chartArea
$chart.chartAreas.Add($chartArea)
[void]$chart.Series.Add("Data")
$legend = New-Object system.Windows.Forms.DataVisualization.charting.Legend
$legend.Name = "Legend"
$legend.Font = "Verdana"
$legend.Alignment = "Center"
$legend.Docking = "top"
$legend.Bordercolor = "#FE5000"
$legend.Legendstyle = "row"
$chart.Legends.Add($legend)
$datapoint = New-Object System.Windows.Forms.DataVisualization.charting.DataPoint(0, $SnapshotSpace)
$datapoint.AxisLabel = "SnapShots " + "(" + $SnapshotSpace + " MB)"
$chart.Series["Data"].Points.Add($datapoint)
$datapoint = New-Object System.Windows.Forms.DataVisualization.charting.DataPoint(0, $VolumeSpace)
$datapoint.AxisLabel = "Volumes " + "(" + $VolumeSpace + " GB)"
$chart.Series["Data"].Points.Add($datapoint)
$chart.Series["Data"].chartType = [System.Windows.Forms.DataVisualization.charting.SerieschartType]::Doughnut
$chart.Series["Data"]["DoughnutLabelStyle"] = "Outside"
$chart.Series["Data"]["DoughnutLineColor"] = "#FE5000"
$Title = New-Object System.Windows.Forms.DataVisualization.charting.Title
$chart.Titles.Add($Title)
$chart.SaveImage($FileName + ".png", "png")
}
#endregion
#region Get-Sdk1Module
function Get-Sdk1Module() {
<#
.SYNOPSIS
Confirms that PureStoragePowerShellSDK version 1 module is loaded, present, or missing. If missing, it will download it and import. If internet access is not available, the function will error.
.DESCRIPTION
Helper function
Supporting function to load required module.
.OUTPUTS
PureStoragePowerShellSDK version 1 module.
#>
$m = "PureStoragePowerShellSDK"
# If module is imported, continue
if (Get-Module | Where-Object { $_.Name -eq $m }) {
}
else {
# If module is not imported, but available on disk, then import
if (Get-InstalledModule | Where-Object { $_.Name -eq $m }) {
Import-Module $m -ErrorAction SilentlyContinue
}
else {
# If module is not imported, not available on disk, then install and import
if (Find-Module -Name $m | Where-Object { $_.Name -eq $m }) {
Write-Warning "The $m module does not exist."
Write-Host "We will attempt to install the module from the PowerShell Gallery. Please wait..."
Install-Module -Name $m -Force -ErrorAction SilentlyContinue -Scope CurrentUser
Import-Module $m -ErrorAction SilentlyContinue
}
else {
# If module is not imported, not available on disk, and we cannot access it online, then abort
Write-Host "Module $m not imported, not available on disk, and we are not able to download it from the online gallery... Exiting."
EXIT 1
}
}
}
}
#endregion
#region Get-Sdk1Module
function Get-Sdk2Module() {
<#
.SYNOPSIS
Confirms that PureStoragePowerShellSDK version 2 module is loaded, present, or missing. If missing, it will download it and import. If internet access is not available, the function will error.
.DESCRIPTION
Helper function
Supporting function to load required module.
.OUTPUTS
PureStoragePowerShellSDK version 2 module.
#>
$m = "PureStoragePowerShellSDK2"
# If module is imported, continue
if (Get-Module | Where-Object { $_.Name -eq $m }) {
}
else {
# If module is not imported, but available on disk, then import
if (Get-InstalledModule | Where-Object { $_.Name -eq $m }) {
Import-Module $m -ErrorAction SilentlyContinue
}
else {
# If module is not imported, not available on disk, then install and import
if (Find-Module -Name $m | Where-Object { $_.Name -eq $m }) {
Write-Warning "The $m module does not exist."
Write-Host "We will attempt to install the module from the PowerShell Gallery. Please wait..."
Install-Module -Name $m -Force -ErrorAction SilentlyContinue -Scope CurrentUser
Import-Module $m -ErrorAction SilentlyContinue
}
else {
# If module is not imported, not available on disk, and we cannot access it online, then abort
Write-Host "Module $m not imported, not available on disk, and we are not able to download it from the online gallery... Exiting."
EXIT 1
}
}
}
}
#endregion
#region Get-DbaToolsModule
function Get-DbaToolsModule() {
<#
.SYNOPSIS
Confirms that dbatools PowerShell module is loaded, present, or missing. If missing, it will download it and import. If internet access is not available, the function will error.
.DESCRIPTION
Helper function
Supporting function to load required module.
.OUTPUTS
dbatools module - https://dbatools.io.
#>
$m = "dbatools"
# If module is imported, continue
if (Get-Module | Where-Object { $_.Name -eq $m }) {
}
else {
# If module is not imported, but available on disk, then import
if (Get-InstalledModule | Where-Object { $_.Name -eq $m }) {
Import-Module $m -ErrorAction SilentlyContinue
}
else {
# If module is not imported, not available on disk, then install and import
if (Find-Module -Name $m | Where-Object { $_.Name -eq $m }) {
Write-Warning "$m module does not exist."
Write-Host "We will attempt to install the module from the PowerShell Gallery. Please wait..."
Install-Module -Name $m -Force -ErrorAction SilentlyContinue -Scope CurrentUser
Import-Module $m -ErrorAction SilentlyContinue
}
else {
# If module is not imported, not available on disk, and we cannot access it online, then abort
Write-Host "Module $m not imported, not available on disk, and we are not able to download it from the online gallery... Exiting."
EXIT 1
}
}
}
}
#endregion
#region Get-ElevatedStatus
function Get-ElevatedStatus() {
<#
.SYNOPSIS
Confirms elevated permissions to run cmdlets.
.DESCRIPTION
Helper function
Supporting function to confirm administrator permissions.
.OUTPUTS
Error on non-administrative permissions.
#>
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Insufficient permissions to run this cmdlet. Open the PowerShell console as an administrator and run this cmdlet again."
Break
}
}
#endregion
#region Get-HypervStatus
function Get-HypervStatus() {
<#
.SYNOPSIS
Confirms that the HyperV role is installed ont he server.
.DESCRIPTION
Helper function
Supporting function to ensure proper role is installed.
.OUTPUTS
Error on missing HyperV role.
#>
$hypervStatus = (Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V).State
if ($hypervStatus -ne "Enabled") {
Write-Host "Hyper-V is not running. This cmdlet must be run on a Hyper-V host."
break
}
}
#endregion
#### END HELPER FUNCTIONS
#### FLASHARRAY FUNCTIONS
#region Get-FlashArrayConnectDetails
function Get-FlashArrayConnectDetails() {
<#
.SYNOPSIS
Outputs FlashArray connection details.
.DESCRIPTION
Output FlashArray connection details including Host and Volume names, LUN ID, IQN / WWN, Volume Provisioned Size, and Host Capacity Written.
.PARAMETER EndPoint
Required. FlashArray IP address or FQDN.
.INPUTS
None
.OUTPUTS
Formatted output details from Get-Pfa2Connection
.EXAMPLE
Get-FlashArrayConnectDetails.ps1 -EndPoint myArray
.NOTES
This cmdlet does not allow for use of OAUth authentication, only token authentication. Arrays with maximum API versions of 2.0 or 2.1 must use OAuth authentication. This will be added in a later revision.
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $EndPoint
)
Get-Sdk2Module
# Connect to FlashArray
if (!($Creds)) {
try {
$FlashArray = Connect-Pfa2Array -EndPoint $EndPoint -Credentials (Get-Credential) -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
else {
try {
$FlashArray = Connect-Pfa2Array -EndPoint $EndPoint -Credentials $Creds -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
# Create an object to store the connection details
$ConnDetails = New-Object -TypeName System.Collections.ArrayList
$Header = "HostName", "VolumeName", "LUNID", "IQNs", "WWNs", "Provisioned(TB)", "HostWritten(GB)"
# Get Connections and filter out VVOL protocol endpoints
$PureConns = (Get-Pfa2Connection -Array $FlashArray | Where-Object { !($_.Volume.Name -eq "pure-protocol-endpoint") })
# For each Connection, build a row with the desired values from Connection, Host, and Volume objects. Add it to ConnDetails.
ForEach ($PureConn in $PureConns) {
$PureHost = (Get-Pfa2Host -Array $FlashArray | Where-Object { $_.Name -eq $PureConn.Host.Name })
$PureVol = (Get-Pfa2Volume -Array $FlashArray | Where-Object { $_.Name -eq $PureConn.Volume.Name })
# Calculate and format Host Written Capacity, Volume Provisioned Capacity
$HostWrittenCapacity = [Math]::Round(($PureVol.Provisioned * (1 - $PureVol.Space.ThinProvisioning)) / 1GB, 2)
$VolumeProvisionedCapacity = [Math]::Round(($PureVol.Provisioned ) / 1TB, 2)
$NewRow = "$($PureHost.Name),$($PureVol.Name),$($PureConn.Lun),$($PureHost.Iqns),$($PureHost.Wwns),"
$NewRow += "$($VolumeProvisionedCapacity),$($HostWrittenCapacity)"
[void]$ConnDetails.Add($NewRow)
}
# Print ConnDetails and make it look nice
$ConnDetails | ConvertFrom-Csv -Header $Header | Sort-Object HostName | Format-Table -AutoSize
}
#endregion
#region Get-FlashArrayVolumeGrowth.ps1
function Get-FlashArrayVolumeGrowth() {
<#
.SYNOPSIS
Retrieves volume growth information over past X days at X percentage of growth.
.DESCRIPTION
Retrieves volume growth in GB from a FlashArray for volumes that grew in past X amount of days at X percentage of growth.
.PARAMETER Arrays
Required. An IP address or FQDN of the FlashArray(s). Multiple arrys can be specified, seperated by commas. Only use single-quotes or no quotes around the arrays parameter object. Ex. -Arrays array1,array2,array3 --or-- -Arrays 'array1,array2,array3'
.PARAMETER MinimumVolumeAgeInDays
Optional. The minimum age in days that a volume must be to report on it. If not specified, defaults to 1 day.
.PARAMETER TimeFrameToCompareWith
Required. The timeframe to compare the volume size against. Accepts '1h', '3h', '24h', '7d', '30d', '90d', '1y'.
.PARAMETER GrowthPercentThreshold
Optional. The minimum percentage of volume growth to report on. Specified as a numerical value from 1-99. If not specified, defaults to '1'.
.PARAMETER DoNotReportGrowthOfLessThan
Optional. If growth in size, in Gigabytes, over the specified period is lower than this value, it will not be reported. Specified as a numerical value. If not specified, defaults to '1'.
.PARAMETER DoNotReportVolSmallerThan
Optional. Volumes that are smaller than this size in Gigabytes will not be reported on. Specified as a numerical value + GB. If not specified, defaults to '1GB'.
.PARAMETER html
Optional. Switch. If present, produces a HTML of the output in the current folder named FlashArrayVolumeGrowthReport.html.
.PARAMETER csv
Optional. Switch. If present, produces a csv comma-delimited file of the output in the current folder named FlashArrayVolumeGrowthReport.csv.
.INPUTS
Specified inputs to calculate volumes reported on.
.OUTPUTS
Volume capacity information to the console, and also to a CSV and/or HTML formatted report (if specified).
.EXAMPLE
Get-FlashArrayVolumeGrowth -Arrays array1,array2 -GrowthPercentThreshold '10' -MinimumVolumeAgeInDays '1' -TimeFrameToCompareWith '7d' -DoNotReportGrowthOfLessThan '1' -DoNotReportVolSmallerThan '1GB' -csv
Retrieve volume capacity report for array 1 and array2 comparing volumes over the last 7 days that:
- volumes that are not smaller than 1GB in size
- must have growth of less than 1GB
- that are at least 1 day old
- have grown at least 10%
- output the report to a CSV delimited file
.NOTES
All arrays specified must use the same credential login.
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string[]] $Arrays,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $MinimumVolumeAgeInDays = "1",
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $TimeFrameToCompareWith,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $GrowthPercentThreshold = "1",
[Parameter(Mandatory = $False)][string] $DoNotReportGrowthOfLessThan = "1",
[Parameter(Mandatory = $False)][string] $DoNotReportVolSmallerThan = "1GB",
[Parameter(Mandatory = $False)][switch] $csv,
[Parameter(Mandatory = $False)][switch] $html
)
Get-Sdk1Module
$cred = Get-Credential
# Connect to FlashArray(s)
$VolThatBreachGrowthPercentThreshold = @()
foreach ($Array in $Arrays) {
if (!($Creds)) {
try {
$FlashArray = New-PfaArray -EndPoint $Array -Credentials $cred -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Array with: $ExceptionMessage"
Return
}
}
else {
try {
$FlashArray = New-PfaArray -EndPoint $Array -Credentials $Creds -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Array with: $ExceptionMessage"
Return
}
}
}
Write-Host ""
Write-Host "Retrieving data from arrays and calculating." -ForegroundColor Yellow
Write-Host "This may take some time depending on number of arrays, volumes, etc. Please wait..." -ForegroundColor Yellow
Write-Host ""
foreach ($Array in $Arrays) {
Write-Host "Calculating array $Array..." -ForegroundColor Green
Write-Host ""
$VolDetails = (Get-PfaVolumes $FlashArray -ErrorAction SilentlyContinue)
$VolDetailsExcludingNewAndSmall = $VolDetails | ? size -GT $DoNotRportVolSmallerThan | Where-Object { (Get-Date $_.created) -lt (Get-Date).AddDays(-$DaysSinceCommissioningToReportAfter) }
$VolDetailsExcludingNewAndSmall = $VolDetailsExcludingNewAndSmall |
% {
$VolumeSpaceMetrics = Get-PfaVolumeSpaceMetricsByTimeRange -VolumeName $_.name -TimeRange $TimeFrameToCompareWith -Array $FlashArray
$_ | Add-Member NoteProperty -PassThru -Force -Name "GrowthPercentage" -Value $([math]::Round((($VolumeSpaceMetrics | select -Last 1).volumes / (1KB + ($VolumeSpaceMetrics | Select-Object -First 1).volumes)), 2)) | # 1KB+ appended to avoid devide by 0 errors
Add-Member NoteProperty -PassThru -Force -Name "GrowthInGB" -Value $([math]::Round(((($VolumeSpaceMetrics | Select-Object -Last 1).volumes - ($VolumeSpaceMetrics | Select-Object -First 1).volumes) / 1GB), 2)) | `
Add-Member NoteProperty -PassThru -Force -Name "ArrayName" -Value $Array
}
$VolThatBreachGrowthPercentThreshold += $VolDetailsExcludingNewAndSmall | Where-Object { $_.GrowthPercentage -gt $GrowthPercentThreshold -and $_.GrowthInGB -gt $DoNotRportGrowthOfLessThan }
if ($VolThatBreachGrowthPercentThreshold) {
Write-Host "The following volumes have grown in the last $TimeFrameToCompareWith above the $GrowthPercentThreshold Percent of thier previous size:" -ForegroundColor Green
($($VolThatBreachGrowthPercentThreshold | Select-Object Name, ArrayName, GrowthInGB, GrowthPercentage) | Format-Table -AutoSize )
$htmlOutput = ($($VolThatBreachGrowthPercentThreshold | Select-Object name, ArrayName, GrowthInGB, GrowthPercentage))
$csvOutput = ($($VolThatBreachGrowthPercentThreshold | Select-Object name, ArrayName, GrowthInGB, GrowthPercentage))
}
}
Write-Host " "
Write-Host "Query parameters specified as:"
Write-Host "1) Ignore volumes created in the last $DaysSinceCommissioningToReportAfter days, 2) Volumes smaller than $($DoNotRportVolSmallerThan / 1GB) GB, and 3) Growth lower than $DoNotRportGrowthOfLessThan GB." -ForegroundColor Green
Write-Host " "
if ($html.IsPresent) {
Write-Host "Building HTML report as requested. Please wait..." -ForegroundColor Yellow
$htmlParams = @{
Title = "Volume Capacity Report for FlashArrays"
Body = Get-Date
PreContent = "<p>Volume Capacity Report for FlashArrays $Arrays :</p>"
PostContent = "<p>Query parameters specified as: 1) Ignore volumes created in the last $DaysSinceCommissioningToReportAfter days, 2) Volumes smaller than $($DoNotRportVolSmallerThan / 1GB) GB, and 3) Growth lower than $DoNotRportGrowthOfLessThan GB.</p>"
}
$htmlOutput | ConvertTo-Html @htmlParams | Out-File -FilePath .\FlashArrayVolumeGrowthReport.html | Out-Null
}
if ($csv.IsPresent) {
Write-Host "Building CSV report as requested. Please wait..." -ForegroundColor Yellow
$csvOutput | Export-Csv -NoTypeInformation -Path .\FlashArrayVolumeGrowthReport.csv
}
else {
Write-Host " "
Write-Host "No volumes on the array(s) match the requested criteria."
Write-Host " "
}
}
#endregion
#region Get-FlashArrayRASession.ps1
function Get-FlashArrayRASession() {
<#
.SYNOPSIS
Retrieves Remote Assist status from a FlashArray.
.DESCRIPTION
Retrieves Remote Assist status from a FlashArray as disabled or enabled in a loop every 30 seconds until stopped.
.PARAMETER EndPopint
Required. FlashArray IP address or FQDN.
.INPUTS
EndPoint IP or FQDN required.
.OUTPUTS
Outputs Remote Assst status.
.EXAMPLE
Get-FlashArrayRASession -EndPoint myarray.mydomain.com
Retrieves the current Remote Assist status and continues check status every 30 seconds until stopped.
.NOTES
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)][ValidateNotNullOrEmpty()][string] $EndPoint
)
Get-Sdk1Module
# Connect to FlashArray
if (!($Creds)) {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials (Get-Credential) -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
else {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials $Creds -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
While ($true) {
If ((Get-PfaRemoteAssistSession -Array $FlashArray).Status -eq 'disabled') {
Set-PfaRemoteAssistStatus -Array $FlashArray -Action connect
}
else {
Write-Warning "Remote Assist session is not active."
Start-Sleep 30
}
}
}
#endregion
#region Restore-PfaProtectionGroupVolumeSnapshots
function Restore-PfaPGroupVolumeSnapshots() {
<#
.SYNOPSIS
Recover all of the volumes from a protection group (PGroup) snapshot.
.DESCRIPTION
This cmdlet will recover all of the volumes from a protection group (PGroup) snapshot in one operation.
.PARAMETER ProtectionGroup
Required. The name of the Protection Group.
.PARAMETER SnapshotName
Required. The name of the snapshot.
.PARAMETER PGroupPrefix
Required. The name of the Protection Group prefix.
.PARAMETER Hostname
Optional. The hostname to attach the snapshots to.
.INPUTS
None
.OUTPUTS
None
.EXAMPLE
Restore-PfaPGroupVolumeSnapshots –Array $array –ProtectionGroup "VOL1-PGroup" –SnapshotName "VOL1-PGroup.001" –Prefix TEST -Hostname HOST1
Restores protection group snapshots named "VOL1-PGroup.001" from PGroup "VOL1-PGroup", adds the prefix of "TEST" to the name, and attaches them to the host "HOST1" on array $array.
.NOTES
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $Array,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $ProtectionGroup,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $SnapshotName,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $PGroupPrefix,
[Parameter(Mandatory = $False)][ValidateNotNullOrEmpty()][string] $Hostname
)
$PGroupVolumes = Get-PfaProtectionGroup -Array $Array -Name $ProtectionGroup -Session $Session
$PGroupSnapshotsSet = $SnapshotName
ForEach ($PGroupVolume in $PGroupVolumes)
{
For($i=0;$i -lt $PGroupVolume.volumes.Count;$i++)
{
$NewPGSnapshotVol = ($PGroupVolume.volumes[$i]).Replace($PGroupVolume.source+":",$Prefix+"-")
$Source = ($PGroupSnapshotsSet+"."+$PGroupVolumes.volumes[$i]).Replace($PGroupVolume.source+":","")
New-PfaVolume -Array $Array -VolumeName $NewPGSnapshotVol -Source $Source
New-PfaHostVolumeConnection -Array $array -HostName $Hostname -VolumeName $NewPGSnapshotVol
}
}
}
#endregion
#region New-FlashArrayPGroupVolumes
function New-FlashArrayPGroupVolumes() {
<#
.SYNOPSIS
Creates volumes to a new FlashArray Protection Group (PGroup).
.DESCRIPTION
This cmdlet will allow for the creation of multiple volumes and adding the created volumes to a new Protection Group (PGroup). The new volume names will default to "$PGroupPrefix-vol1", "PGroupPrefix-vol2" etc.
.PARAMETER PGroupPrefix
Required. The name of the Protection Group prefix to add volumes to. This parameter specifies the prefix of the PGroup name. The suffix defaults to "-PGroup". Example: -PGroupPrefix "database". The full PGroup name will be "database-PGroup".
This PGroup will be created as new and must not already exist on the array.
This prefix will also be used to uniquely name the volumes as they are created.
.PARAMETER VolumeSizeGB
Required. The size of the new volumes in Gigabytes (GB).
.PARAMETER NumberOfVolumes
Required. The number of volumes that are to be created. Each volume will be named "vol" with an ascending number following (ie. vol1, vol2, etc.). Each volume name will also contain the $PGroupPrefix variable as the name prefix.
.INPUTS
None
.OUTPUTS
None
.EXAMPLE
New-FlashArrayPGroupVolumes -PGroupPrefix "database" -VolumeSizeGB "200" -NumberOfVolumes "3"
Creates 3-200GB volumes, named "database-vol1", "database-vol2", and "database-vol3". Each volume is added to the new Protection Group "database-PGroup".
.NOTES
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $PGroupPrefix,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $VolumeSizeGB,
[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $NumberOfVolumes
)
Get-Sdk1Module
# Connect to FlashArray
if (!($Creds)) {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials (Get-Credential) -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
else {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials $Creds -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
$Volumes = @()
for ($i = 1; $i -le $NumberOfVolumes; $i++) {
New-PfaVolume -Array $FlashArray -VolumeName "$PGroupPrefix-Vol$i" -Unit G -Size $VolumeSizeGB
$Volumes += "$PGroupPrefix-Vol$i"
}
$Volumes -join ","
New-PfaProtectionGroup -Array $FlashArray -Name "$PGGroupPrefix-PGroup" -Volumes $Volumes
}
#endregion
#region Get-FlashArrayQuickCapacityStats
function Get-FlashArrayQuickCapacityStats() {
<#
.SYNOPSIS
Quick way to retrieve FlashArray capacity statistics.
.DESCRIPTION
Retrieves high level capcity statistics from a FlashArray.
.PARAMETER Names
Required. A single name or array of names, comma seperated, of arrays to show acapacity information.
.INPUTS
Single or multiple FlashArray IP addresses or FQDNs.
.OUTPUTS
Outputs array capacity information
.EXAMPLE
Get-FlashArrayQuickCapacityStats -Names 'array1, array2'
Retrieves capacity statistic information from FlashArray's array1 and array2.
.NOTES
The arrays supplied in the "Names" parameter must use the same credentials for access.
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)][ValidateNotNullOrEmpty()][string] $Names
)
Get-Sdk1Module
if (!($Creds)) {
$arrays = @()
foreach ($name in $names) {
try {
$arrays += New-PfaArray -EndPoint $name -Credentials $cred -IgnoreCertificateError -Verbose -ErrorAction Stop
}
catch {
Write-Output "Error accessing $name : $_"
}
}
}
else {
$arrays = @()
foreach ($name in $names) {
try {
$arrays += New-PfaArray -EndPoint $name -Credentials $Creds -IgnoreCertificateError -Verbose -ErrorAction Stop
}
catch {
Write-Output "Error accessing $name : $_"
}
}
}
$spacemetrics = $arrays | Get-PfaArraySpaceMetrics -Verbose
$spacemetrics = $spacemetrics | Select-Object *, @{N = "expvolumes"; E = { $_.volumes * $_.data_reduction } }, @{N = "provisioned"; E = { ($_.total - $_.system) / (1 - $_.thin_provisioning) * $_.data_reduction } }
$totalcapacity = ($spacemetrics | Measure-Object capacity -Sum).Sum
$totalvolumes = ($spacemetrics | Measure-Object volumes -Sum).Sum
$totalvolumes_beforereduction = ($spacemetrics | Measure-Object expvolumes -Sum).Sum
$totalprovisioned = ($spacemetrics | Measure-Object provisioned -Sum).Sum
$1TB = 1024 * 1024 * 1024 * 1024
$date = Get-Date
Write-Host "On $($spacemetrics.Count) Pure FlashArrays, there is $([int]($totalcapacity/$1TB)) TB of capacity; $([int]($totalvolumes/$1TB)) TB written, reduced from $([int]($totalvolumes_beforereduction/$1TB)) TB. Total provisioned: $([int]($totalprovisioned/$1TB)) TB."
Write-Host "Data collected on $date"
}
#endregion
#region Get-HostVolumeInfo
function Get-AllHostVolumeInfo() {
<#
.SYNOPSIS
Retrieves Host Volume information from FlashArray.
.DESCRIPTION
Retrieves Host Volume information including volumes attributes from a FlashArray.
.INPUTS
EndPoint IP or FQDN required
.OUTPUTS
Outputs Host volume information
.EXAMPLE
Get-HostVolumeinfo -EndPoint myarray.mydomain.com
Retrieves Host Volume information from the FlashArray myarray.mydomain.com.
.NOTES
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Position=0,Mandatory=$True)][ValidateNotNullOrEmpty()][string] $EndPoint
)
Get-Sdk1Module
# Connect to FlashArray
if (!($Creds)) {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials (Get-Credential) -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
else {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials $Creds -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
$hostNames = Get-PfaHosts -array $FlashArray | Select-Object -Property name
foreach ($hostName in $hostnames) {
$hostvols = Get-PfaHostVolumeConnections -Array $FlashArray -Name $hostName.name
$hostvols | Format-Table -AutoSize;
ForEach-Object -InputObject $hostvols {
$vols = $_.vol;
$volattribs = @();
if ($_.vol.count -gt 1) {
for ($i = 0; $i -lt $_.vol.count; $i++) {
$volattrib = Get-PfaVolume -Array $FlashArray -Name $vols[$i];
$volattribs += $volattrib;
}
$volattribs |
Select-Object name, created, source, serial, @{Name = "Size(GB)"; Expression = { $_.size / 1GB } } |
Format-Table -AutoSize;
}
else {
Get-PfaVolume -Array $FlashArray -Name $_.vol |
Select-Object name, created, source, serial, @{Name = "Size(GB)"; Expression = { $_.size / 1GB } } |
Format-Table -AutoSize;
}
}
}
}
#endregion
#region Get-FlashArraySerialNumbers
function Get-FlashArraySerialNumbers() {
<#
.SYNOPSIS
Retrieves FlashArray volume serial numbers connected to the host.
.DESCRIPTION
Cmdlet queries WMI on the localhost to retrieve the disks that are associated to Pure FlashArrays.
.INPUTS
EndPoint IP or FQDN required.
.OUTPUTS
Outputs serial numbers of FlashArrays devices.
.EXAMPLE
Get-FlashArraySerialNumbers
Returns serial number information on Pure FlashArray disk devices connected to the host.
#>
$AllDevices = Get-WmiObject -Class Win32_DiskDrive -Namespace 'root\CIMV2'
ForEach ($Device in $AllDevices) {
if ($Device.Model -like 'PURE FlashArray*') {
@{
Name = $Device.Name;
Caption = $Device.Caption;
Index = $Device.Index;
SerialNo = $Device.SerialNumber;
}
}
}
}
#endregion
#region New-HypervClusterVolumeReport
function New-HypervClusterVolumeReport() {
<#
.SYNOPSIS
Creates a Excel report on volumes connected to a Hyper-V cluster.
.DESCRIPTION
This creates separate CSV files for VM, Windows Hosts, and FlashArray information that is part of a HyperV cluster. It then takes that output and places it into a an Excel workbook that contains sheets for each CSV file.
.PARAMETER VmCsvFileName
Optional. Defaults to VMs.csv.
.PARAMETER WinCsvFileName
Optional. defaults to WindowsHosts.csv.
.PARAMETER PfaCsvFileName
Optional. defaults to FlashArrays.csv.
.PARAMETER ExcelFile
Optional. defaults to HypervClusterReport.xlsx.
.INPUTS
Endpoint is mandatory. VM, Win, and PFA csv file names are optional.
.OUTPUTS
Outputs individual CSV files and creates an Excel workbook that is built using the required PowerShell module ImportExcel, created by Douglas Finke.
.EXAMPLE
New-HypervClusterVolumeReport -EndPoint myarray -VmCsvName myVMs.csv -WinCsvName myWinHosts.csv -PfaCsvName myFlashArray.csv -ExcelFile myExcelFile
This will create three separate CSV files with HyperV cluster information and incorporate them into a single Excel workbook.
.NOTES
This cmdlet can utilize the global $Creds variable for FlashArray authentication. Set the variable $Creds by using the command $Creds = Get-Credential.
#>
[CmdletBinding()]
Param (
[Parameter(Position = 0, Mandatory = $True)][ValidateNotNullOrEmpty()][string] $EndPoint,
[Parameter(Mandatory=$False)][string]$VmCsvFileName = "VMs.csv",
[Parameter(Mandatory=$False)][string]$WinCsvFileName = "WindowsHosts.csv",
[Parameter(Mandatory=$False)][string]$PfaCsvFileName = "FlashArrays.csv",
[Parameter(Mandatory=$False)][string]$ExcelFile = "HypervClusterReport.xlxs"
)
try {
Get-ElevatedStatus
Get-HypervStatus
## Check for modules & features
Write-Host "Checking, installing, and importing prerequisite modules."
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$modulesArray = @(
"PureStoragePowerShellSDK",
"ImportExcel"
)
ForEach ($mod in $modulesArray) {
If (Get-Module -ListAvailable $mod) {
Continue
}
Else {
Install-Module $mod -Force -ErrorAction 'SilentlyContinue'
Import-Module $mod -ErrorAction 'SilentlyContinue'
}
}
Write-Host "Checking and installing prerequisite Windows Features."
$osVer = (Get-ComputerInfo).WindowsProductName
$featuresArray = @(
"hyper-v-powershell",
"rsat-clustering-powershell"
)
ForEach ($fea in $featuresArray) {
If (Get-WindowsFeature $fea | Select-Object -ExpandProperty installed) {
Continue
}
Else {
If ($osVer -le "2008") {
Add-WindowsFeature -Name $fea -Force -ErrorAction 'SilentlyContinue'
}
Else {
Install-WindowsFeature -Name $fea -Force -ErrorAction 'SilentlyContinue'
}
}
}
# Connect to FlashArray
if (!($Creds)) {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials (Get-Credential) -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
else {
try {
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials $Creds -IgnoreCertificateError
}
catch {
$ExceptionMessage = $_.Exception.Message
Write-Error "Failed to connect to FlashArray endpoint $Endpoint with: $ExceptionMessage"
Return
}
}
## Get a list of VMs - VM Sheet
$vmList = Get-VM -ComputerName (Get-ClusterNode)
$vmList | ForEach-Object { $vmState = $_.state; $vmName = $_.name; Write-Output $_; } | ForEach-Object { Get-VHD -ComputerName $_.ComputerName -VMId $_.VMId
} | Select-Object -Property path, @{n = 'VMName'; e = { $vmName } }, @{n = 'VMState'; e = { $vmState } }, computername, vhdtype, @{Label = 'Size(GB)'; expression = { [Math]::Round($_.size / 1gb, 2) -as [int] } }, @{label = 'SizeOnDisk(GB)'; expression = { [Math]::Round($_.filesize / 1gb, 2) -as [int] } } | Export-Csv $VmCsvFileName
Import-Csv $VmCsvFileName | Export-Excel -Path $ExcelFile -AutoSize -WorkSheetname 'VMs'
## Get windows physical disks - Windows Host Sheet
Get-ClusterNode | ForEach-Object { Get-WmiObject Win32_Volume -Filter "DriveType='3'" -ComputerName $_ | ForEach-Object {
[pscustomobject][ordered]@{
Server = $_.__Server
Label = $_.Label
Name = $_.Name
TotalSize_GB = ([Math]::Round($_.Capacity / 1GB, 2))
FreeSpace_GB = ([Math]::Round($_.FreeSpace / 1GB, 2))
SizeOnDisk_GB = ([Math]::Round(($_.Capacity - $_.FreeSpace) / 1GB, 2))
}
} } | Export-Csv $WinCsvFileName -NoTypeInformation
Import-Csv $WinCsvFileName | Export-Excel -Path $ExcelFile -AutoSize -WorkSheetname 'Windows Hosts'
## Get Pure FlashArray volumes and space - FlashArray Sheet
Function GetSerial {
[Cmdletbinding()]
Param( [Parameter(ValueFromPipeline)]
$findserial)
$GetVol = Get-Volume -FilePath $findserial | Select-Object -ExpandProperty path
$GetDiskNum = Get-Partition | Where-Object -Property accesspaths -CContains $getvol | Select-Object disknumber
Get-Disk -Number $getdisknum.disknumber | Select-Object serialnumber
}
$pathQ = $VmList | ForEach-Object { Get-VHD -ComputerName $_.ComputerName -VMId $_.VMId } | Select-Object -ExpandProperty path
$serials = GetSerial { $pathQ } -ErrorAction SilentlyContinue
## FlashArray volumes
$pureVols = Get-PfaVolumes -Array $FlashArray | Where-Object { $serials.serialnumber -contains $_.serial } | ForEach-Object { Get-PfaVolumeSpaceMetrics -Array $FlashArray -VolumeName $_.name } | Select-Object name, size, total, data_reduction
$pureVols | Select-Object Name, @{Name = "Size(GB)"; Expression = { [math]::round($_.size / 1gb, 2) } }, @{Name = "SizeOnDisk(GB)"; Expression = { [math]::round($_.total / 1gb, 2) } }, @{Name = "DataReduction"; Expression = { [math]::round($_.data_reduction, 2) } } | Export-Csv $PfaCsvFileName -NoTypeInformation
Import-Csv $PfaCsvFileName | Export-Excel -Path $ExcelFile -AutoSize -WorkSheetname 'FlashArrays'
}
catch {
Write-Host "There was a problem running this cmdlet. Please try again or submit an Issue in the GitHub Repository."
}
}
#endregion
#region Sync-FlashArrayHosts
function Sync-FlashArrayHosts() {
<#
.SYNOPSIS
Synchronizes the hosts amd host protocols between two FlashArrays.
.DESCRIPTION
This cmdlet will retrieve the current hosts from the Source array and create them on the target array. It will also add the FC (WWN) or iSCSI (iqn) settings for each host on the Target array.
.PARAMETER SourceArray
Required. FQDN or IP address of the source FlashArray.
.PARAMETER TargetArray
Required. FQDN or IP address of the source FlashArray.
.PARAMETER Protocol
Required. 'FC' for Fibre Channel WWNs or 'iSCSI' for iSCSI IQNs.
.INPUTS
None