Guest User

Untitled

a guest
Jul 5th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. Clear-Host
  2. function get-VolumesProtectedByProtectionGroup {
  3. param($arr, $ProtectionGroupName)
  4. {
  5. $ProtectedVolumes = @()
  6. $PG = Get-PfaProtectionGroup $arr -Name $ProtectionGroupName
  7. $PG.Hgroups | where-object{$_} | foreach-object {
  8. # Foreach host group protected by PG
  9. $HGVolumeConnections = Get-PfaHostGroupVolumeConnections $arr -HostGroupName $_
  10. $HGVolumeConnections | foreach-object {
  11. #Foreach hostgroup-volume direct connection
  12. $ProtectedVolumes += $_.vol
  13. Write-Host $_.vol
  14. }
  15. $HG = Get-PfaHostGroup $arr -Name $_
  16. $HG.hosts | where-object {$_} | foreach-object {
  17. # Foreach host in host group
  18. $HostVolumeConnections = Get-PfaHostVolumeConnections $arr -Name $_ | where-object { -not $_.hgroup } # Filter out shared connections, they're already captured in HGVolumeConnections
  19. $HostVolumeConnections | foreach-object {
  20. #Foreach host connected to hostgroup, where host is connected to a volume
  21. $ProtectedVolumes += $_.vol
  22. Write-Host $_.vol
  23. }
  24. }
  25. }
  26. $PG.hosts | where-object {$_} | foreach-object {
  27. # Foreach host protected by PG
  28. $HostVolumeConnections = Get-PfaHostVolumeConnections $arr -Name $_
  29. $HostVolumeConnections | foreach-object {
  30. #Foreach host-volume connection
  31. $ProtectedVolumes += $_.vol
  32. Write-Host $_.vol
  33. }
  34. }
  35. $PG.volumes | where-object {$_} | foreach-object {
  36. $ProtectedVolumes += $_
  37. Write-Host $_
  38. }
  39. Write-Output $ProtectedVolumes
  40. }
  41. }
  42.  
  43. #get effected vCenter Object
  44. $location = Read-Host -Prompt "Input source cluster to move, or Quit to end"
  45. write-host " "
  46.  
  47. #begin Mulitiple Cluster loop
  48. while ($location -notlike $null -and $location -notlike "quit" -or $location -notlike "Quit")
  49. {
  50. #Read in Map file
  51. $inputFile = $((get-location).path)+'\'+(get-childitem | where-object {$_.name -like "$location*-migration-map.csv"}).name
  52.  
  53. Import-csv $inputFile | Foreach-Object {
  54. $SourcevCenter = $_.SourceVctr
  55. $vCenterUser = $_.vctrUser
  56. $SourceFlashArray = $_.SourceArray
  57. $ArrayUser = $_.arrayUser
  58. $DestvCenter = $_.DestVctr
  59. $DestFlashArray = $_.DestArray
  60. $dVS = $_.dVS
  61. $ProtectionGroup = $_.ProtGroup
  62. $HostGroup = $_.DestHostGroup
  63. $LUN = $_.lun
  64. }
  65.  
  66. $ArrayPass = Read-Host -prompt "Enter Array Password for $ArrayUser" -AsSecureString
  67.  
  68. #connect to source Flash Array
  69. $SourceEndPoint = New-PfaArray -EndPoint $SourceFlashArray -UserName $ArrayUser -Password $ArrayPass -IgnoreCertificateError -ErrorAction stop
  70.  
  71. #Start Snapshot and replication
  72. #$SourceVols = Get-PfaProtectionGroup -array $SourceEndPoint -name $protectionGroup
  73. $sourceVols = Get-VolumesProtectedByProtectionGroup $SourceEndpoint $protectionGroup
  74.  
  75. write-host $SourceEndPoint.endpoint
  76. write-host $protectionGroup
  77. write-host $sourceVols
  78.  
  79. $location = Read-Host -Prompt "Input source cluster to move, or Quit to end"
  80. write-host " "
Add Comment
Please, Sign In to add comment