I am using powershell scripting with the examples that are in Starwind, the script is: CreateHA(Two Nodes). But when i run it, only say me an external component has caused and exception or in Spanish: un componente externo produjo una excepción, as it is a testing i am using the default user and password, the patch is: C:\images
StarWind Version: 8.0.0.12767
And i am doing it with two Windows Server 2016.
Here is the script:
Code: Select all
Import-Module StarWindX
try
{
Enable-SWXLog
$server = New-SWServer -host 127.0.0.1 -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.HostName = "localhost"
$firstNode.ImagePath = "C:\images"
$firstNode.ImageName = "masterImg21"
$firstNode.Size = 1024
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "targetha21"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=10.0.132.102:3260"
$firstNode.HBInterface = "#p2=10.1.1.2:3260"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 4096
$secondNode = new-Object Node
$secondNode.HostName = "10.0.132.102"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "C:\images"
$secondNode.ImageName = "partnerImg22"
$secondNode.Size = 1024
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "partnerha22"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=10.0.132.101:3260"
$secondNode.HBInterface = "#p1=10.1.1.1:3260"
$secondNode.SyncSessionCount = 1
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
while ($device.SyncStatus -ne [SwHaSyncStatus]::SW_HA_SYNC_STATUS_SYNC)
{
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
Start-Sleep -m 2000
$device.Refresh()
}
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}