Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear-Host
- function get-VolumesProtectedByProtectionGroup {
- param($arr, $ProtectionGroupName)
- {
- $ProtectedVolumes = @()
- $PG = Get-PfaProtectionGroup $arr -Name $ProtectionGroupName
- $PG.Hgroups | where-object{$_} | foreach-object {
- # Foreach host group protected by PG
- $HGVolumeConnections = Get-PfaHostGroupVolumeConnections $arr -HostGroupName $_
- $HGVolumeConnections | foreach-object {
- #Foreach hostgroup-volume direct connection
- $ProtectedVolumes += $_.vol
- Write-Host $_.vol
- }
- $HG = Get-PfaHostGroup $arr -Name $_
- $HG.hosts | where-object {$_} | foreach-object {
- # Foreach host in host group
- $HostVolumeConnections = Get-PfaHostVolumeConnections $arr -Name $_ | where-object { -not $_.hgroup } # Filter out shared connections, they're already captured in HGVolumeConnections
- $HostVolumeConnections | foreach-object {
- #Foreach host connected to hostgroup, where host is connected to a volume
- $ProtectedVolumes += $_.vol
- Write-Host $_.vol
- }
- }
- }
- $PG.hosts | where-object {$_} | foreach-object {
- # Foreach host protected by PG
- $HostVolumeConnections = Get-PfaHostVolumeConnections $arr -Name $_
- $HostVolumeConnections | foreach-object {
- #Foreach host-volume connection
- $ProtectedVolumes += $_.vol
- Write-Host $_.vol
- }
- }
- $PG.volumes | where-object {$_} | foreach-object {
- $ProtectedVolumes += $_
- Write-Host $_
- }
- Write-Output $ProtectedVolumes
- }
- }
- #get effected vCenter Object
- $location = Read-Host -Prompt "Input source cluster to move, or Quit to end"
- write-host " "
- #begin Mulitiple Cluster loop
- while ($location -notlike $null -and $location -notlike "quit" -or $location -notlike "Quit")
- {
- #Read in Map file
- $inputFile = $((get-location).path)+'\'+(get-childitem | where-object {$_.name -like "$location*-migration-map.csv"}).name
- Import-csv $inputFile | Foreach-Object {
- $SourcevCenter = $_.SourceVctr
- $vCenterUser = $_.vctrUser
- $SourceFlashArray = $_.SourceArray
- $ArrayUser = $_.arrayUser
- $DestvCenter = $_.DestVctr
- $DestFlashArray = $_.DestArray
- $dVS = $_.dVS
- $ProtectionGroup = $_.ProtGroup
- $HostGroup = $_.DestHostGroup
- $LUN = $_.lun
- }
- $ArrayPass = Read-Host -prompt "Enter Array Password for $ArrayUser" -AsSecureString
- #connect to source Flash Array
- $SourceEndPoint = New-PfaArray -EndPoint $SourceFlashArray -UserName $ArrayUser -Password $ArrayPass -IgnoreCertificateError -ErrorAction stop
- #Start Snapshot and replication
- #$SourceVols = Get-PfaProtectionGroup -array $SourceEndPoint -name $protectionGroup
- $sourceVols = Get-VolumesProtectedByProtectionGroup $SourceEndpoint $protectionGroup
- write-host $SourceEndPoint.endpoint
- write-host $protectionGroup
- write-host $sourceVols
- $location = Read-Host -Prompt "Input source cluster to move, or Quit to end"
- write-host " "
Add Comment
Please, Sign In to add comment