Hello All,
I am writing a powershell script, where I want the user to input all the source and destination info.
I am collecting the source volume from read-host .
Once the source volume is choosen, I need to store the choosen volume size in a variable so that destination volume can be created with the same size.
Please check the code and suggest.
SAMPLE CODE:
=============
# Script to check and initiate snapmirror process for 7M
Import-Module DataONTAP
write-host "Enter the FQDN/IP of the source controller"
$Source_Controller = read-host
$cred = Get-Credential "root"
write-host "Source Controller Name= $Source_Controller"
write-host "==========================================="
Connect-NaController $Source_Controller -Credential $cred
Write-Host "Snapmirror process will be started"
Get-NaVolSpace | ft Volume,VolumeSize,@{Name="VolSize(GB)";expression={$_.volumesize/1GB}} -AutoSize
Write-Host "Choose the source volume which needs to have DR"
$Source_Vol = Read-Host.name
Write-Host " $Source_Vol is choosen for which DR has to be configured"
write-host "Enter the FQDN/IP of the Destination/DR controller"
$DR_controller = read-host
write-host "DR Controller Name=$DR_controller"
write-host "=================================="
Connect-NaController $DR_controller -Credential $cred
Write-Host "choose the aggregate where you want the DR volume to be created"
Get-NaAggr | ft Name,State,TotalSize,Used,Available,@{Name="Totalsize(GB)";expression={$_.TotalSize/1GB}},@{Name="AvailableSize(GB)";expression={$_.Available/1GB}}
$DR_Aggr = Read-Host
Write-Host " Source controller: $source_controller,Source volume: $Source_Vol, DR Controller: $DR_controller,DR_Aggr: $DR_Aggr are choosen as the vol/Aggr for DR creation" -ForegroundColor DarkGreen
Write-Host " Creating DR volume in DR controller"