Code: Select all
Import-Module StarWindX
try
{
$server = New-SWServer -host 192.168.1.138 -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.ImagePath = "My computer\C"
$firstNode.ImageName = "masterImg1"
$firstNode.Size = 256
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "targetha1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=30.30.1.139:3260"
$firstNode.HBInterface = "#p2=192.168.1.139:3260"
$firstNode.CacheSize = 64
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
$secondNode = new-Object Node
$secondNode.HostName = "192.168.1.139"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\C"
$secondNode.ImageName = "partnerImg1"
$secondNode.Size = 256
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "partnerha1"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=30.30.1.138:3260"
$secondNode.HBInterface = "#p1=192.168.1.138:3260"
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
$server.Disconnect()