Page 1 of 1

Powershell + Starwind VSAN for Vsphere

Posted: Thu Apr 14, 2022 1:59 pm
by kaderb
Hi Guys,

It's perhaps a silly question, but I prefer ask .

Is it possible to use Powershell with Starwind for Vsphere?

The main reason to do that is to avoid using a windows server.

Thanks !

Regards

Kader

Re: Powershell + Starwind VSAN for Vsphere

Posted: Thu Apr 14, 2022 2:20 pm
by yaroslav (staff)
Greetings,

Welcome to StarWind Forum and thanks for your question.
Yes. Please install the StarWindX module on any Windows10 PC or VM that has a connection to the VM.

Re: Powershell + Starwind VSAN for Vsphere

Posted: Fri Apr 15, 2022 1:11 pm
by kaderb
Thanks , Great news!
I want to use a free licence applied to the VSA Starwind for Vsphere (linux) and configure it with powershell.

You confirm again?

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon Apr 18, 2022 7:53 am
by yaroslav (staff)
Greetings,

Yes, it is doable. You need to install StarWind Management Console and Integrated Component Library to your Windows machine and run the script from there.

Re: Powershell + Starwind VSAN for Vsphere

Posted: Tue Apr 19, 2022 3:08 pm
by kaderb
Hi Guys !

I have tried to configure 3-nodes of VSAN for Vsphere by powershell with no success :(
I'm facing an
Invalid channel format [2]
The Iscsi ans the Sync connection are direct connected.

I have followed this technical paper : https://www.starwindsoftware.com/resour ... e-vsphere/


Here's my modified script :

Code: Select all

param($addr="57.7.10.42", $port=3261, $user="root", $password="starwind",
	$addr2="57.7.10.43", $port2=$port, $user2=$user, $password2=$password,
	$addr3="57.7.10.44", $port3=$port, $user3=$user, $password3=$password,
	$fileName="New_disk",
	#$filePath="My computer\E\Starwind",
$filePath="VSA Storage\mnt",
	$numaNode=0,
#common
	$initMethod="Clear",
	$size=1000,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath=$filePath,
    $imageName=$fileName,
	$createImage=$false,
	$targetAlias="starwind-esx-4",
	$autoSynch=$true,
	$poolName="",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize="",
	$syncInterface="#p2=172.16.21.20,p3=172.16.23.20 ",
	$hbInterface="#p2=172.16.11.20:3260;#p3=172.16.13.30:3260 -f $addr2,$addr3",
#secondary node
	$imagePath2=$filePath,
    $imageName2=$fileName,
	$createImage2=$false,
	$targetAlias2="starwind-esx-5",
	$autoSynch2=$true,
	$poolName2="",
	$syncSessionCount2=1,
	$aluaOptimized2=$true,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2="#p1=172.16.21.10:3260;#p3=172.16.22.30:3260 ",
	$hbInterface2="#p1=172.16.11.10:3260;#p3=172.16.12.30:3260 -f $addr1,$addr3",
#third node
	$imagePath3=$filePath,
    $imageName3=$fileName,
	$createImage3=$false,
	$targetAlias3="starwind-esx-6",
	$autoSynch3=$true,
	$poolName3="",
	$syncSessionCount3=1,
	$aluaOptimized3=$true,
	$cacheMode3=$cacheMode,
	$cacheSize3=$cacheSize,
	$syncInterface3="#p1=172.16.22.10:3260;#p2=172.16.23.20:3260 ",
	$hbInterface3="#p1=172.16.12.10:3260;#p2=172.16.12.20:3260 -f $addr1;$addr2"
)

Import-Module StarWindX

try
{
	Enable-SWXLog

	    
	$firstNode = new-Object Node

	$firstNode.HostName = $addr
	$firstNode.ImagePath = $imagePath
	$firstNode.ImageName = $imageName
	$firstNode.Size = $size
	$firstNode.CreateImage = $createImage
	$firstNode.TargetAlias = $targetAlias
	$firstNode.AutoSynch = $autoSynch
	$firstNode.SyncInterface = $syncInterface
	$firstNode.HBInterface = $hbInterface
	$firstNode.PoolName = $poolName
	$firstNode.SyncSessionCount = $syncSessionCount
	$firstNode.ALUAOptimized = $aluaOptimized
	$firstNode.SectorSize = $sectorSize
	$firstNode.CacheMode = $cacheMode
	$firstNode.CacheSize = $cacheSize
	$firstNode.FailoverStrategy = $failover

	$secondNode = new-Object Node

	$secondNode.HostName = $addr2
	$secondNode.HostPort = $port2
	$secondNode.Login = $user2
	$secondNode.Password = $password2
	$secondNode.ImagePath = $imagePath2
	$secondNode.ImageName = $imageName2
	$secondNode.CreateImage = $createImage2
	$secondNode.TargetAlias = $targetAlias2
	$secondNode.AutoSynch = $autoSynch2
	$secondNode.SyncInterface = $syncInterface2
	$secondNode.HBInterface = $hbInterface2
	$secondNode.SyncSessionCount = $syncSessionCount2
	$secondNode.ALUAOptimized = $aluaOptimized2
	$secondNode.CacheMode = $cacheMode2
	$secondNode.CacheSize = $cacheSize2
	$secondNode.FailoverStrategy = $failover

	$thirdNode = new-Object Node

	$thirdNode.HostName = $addr3
	$thirdNode.HostPort = $port3
	$thirdNode.Login = $user3
	$thirdNode.Password = $password3
	$thirdNode.ImagePath = $imagePath3
	$thirdNode.ImageName = $imageName3
	$thirdNode.CreateImage = $createImage3
	$thirdNode.TargetAlias = $targetAlias3
	$thirdNode.AutoSynch = $autoSynch3
	$thirdNode.SyncInterface = $syncInterface3
	$thirdNode.HBInterface = $hbInterface3
	$thirdNode.SyncSessionCount = $syncSessionCount3
	$thirdNode.ALUAOptimized = $aluaOptimized3
	$thirdNode.CacheMode = $cacheMode3
	$thirdNode.CacheSize = $cacheSize3
	$thirdNode.FailoverStrategy = $failover


    $server = New-SWServer -host $addr -port $port -user $user -password $password

	$server.Connect()

     #create image file
	New-ImageFile -server $server -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize -header "test"

	$device
    
	#create target
	$target = New-Target -server $server -alias $targetAlias -devices $device.Name

	$target
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}


###---------------
try
{
	Enable-SWXLog
    $server2 = New-SWServer -host $addr2 -port $port -user $user -password $password
    echo "Serveur 2"
	$server2.Connect()

     #create image file
	New-ImageFile -server $server2 -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server2 -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize -header "test"

	$device
    
	#create target
	$target = New-Target -server $server2 -alias $targetAlias2 -devices $device.Name

	$target
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server2.Disconnect()
}

try
{
	Enable-SWXLog
    $server3 = New-SWServer -host $addr3 -port $port -user $user -password $password

	$server3.Connect()

     #create image file
	New-ImageFile -server $server3 -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server3 -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize -header "test"

	$device
    
	#create target
	$target = New-Target -server $server3 -alias $targetAlias3 -devices $device.Name

	$target
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server3.Disconnect()
}
try
{
   
	$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode    -thirdNode $thirdNode   -initMethod $initMethod 
    
	$syncState = $device.GetPropertyValue("ha_synch_status")

	while ($syncState -ne "1")
	{
		#
		# Refresh device info
		#
		$device.Refresh()

		$syncState = $device.GetPropertyValue("ha_synch_status")
		$syncPercent = $device.GetPropertyValue("ha_synch_percent")

		Start-Sleep -m 2000

		Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
	}
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}

Re: Powershell + Starwind VSAN for Vsphere

Posted: Tue Apr 19, 2022 7:02 pm
by yaroslav (staff)
Hi,

The way you specify the channels is not valid. Please refer to this thread for more details https://forums.starwindsoftware.com/vie ... p+3#p31505.

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon Apr 25, 2022 2:22 pm
by kaderb
I have tried to change the script , the error have disappeared but no sync at all.

Code: Select all

param($addr="57.7.10.42", $port=3261, $user="root", $password="starwind",
    $addr2="57.7.10.43", $port2=$port, $user2=$user, $password2=$password,
	$addr3="57.7.10.44", $port3=$port, $user3=$user, $password3=$password,
    
    $addr_iscsi_1_11="172.16.11.10",
    $addr_iscsi_1_13="172.16.13.10",
    $addr_sync_1_21="172.16.21.10",
    $addr_sync_1_23="172.16.23.10",

    $addr_iscsi_2_11="172.16.11.20",
    $addr_iscsi_2_12="172.16.12.20",
    $addr_sync_2_21="172.16.21.20",
    $addr_sync_2_22="172.16.22.20",


    $addr_iscsi_3_12="172.16.12.30",
    $addr_iscsi_3_13="172.16.13.30",
    $addr_sync_3_22="172.16.22.30",
    $addr_sync_3_23="172.16.23.30",



	$fileName="New_disk232",
#	$filePath="My computer\E\Starwind",
$filePath="VSA Storage\mnt",
	$numaNode=0,
#common
	$initMethod="Clear",
	$size=1000,
	$sectorSize=512,
	$failover=0,
#primary node
	#$imagePath="VSA Storage\mnt",
    $imagePath=$filePath,
	$imageName="masterImg3131",
	$createImage=$true,
	$targetAlias="targetha31",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="none",
	$cacheSize=128,
	$syncInterface=$("#p2={0}:3260;#p3={1}:3260" -f $addr_sync_2_21,$addr_sync_3_23),
	$hbInterface=$("#p2={0}:3260;#p3={1}:3260" -f $addr_iscsi_2_11,$addr_iscsi_3_13),
    $createTarget=$true,
#secondary node
	#$imagePath2="VSA Storage\mnt",
    $imagePath2=$filePath,
	$imageName2="partnerImg323",
	$createImage2=$true,
	$targetAlias2="partnerha32",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$false,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2=$("#p1={0}:3260;#p3={1}:3260" -f $addr_sync_1_21,$addr_sync_3_22),
	$hbInterface2=$("#p1={0}:3260;#p3={1}:3260" -f $addr_iscsi_1_11,$addr_iscsi_3_12),
    $createTarget2=$true,
#third node
	#$imagePath3="VSA Storage\mnt",
    $imagePath3=$filePath,
	$imageName3="partnerImg333",
	$createImage3=$true,
	$targetAlias3="partnerha33",
	$autoSynch3=$true,
	$poolName3="pool1",
	$syncSessionCount3=1,
	$aluaOptimized3=$false,
	$cacheMode3=$cacheMode,
	$cacheSize3=$cacheSize,
	$syncInterface3=$("#p1={0}:3260;#p2={1}:3260" -f $addr_sync_1_23,$addr_sync_2_22),
	$hbInterface3=$("#p1={0}:3260;#p2={1}:3260" -f $addr_iscsi_1_13,$addr_iscsi_2_12),
    $createTarget3=$true
	)

Import-Module StarWindX

try
{
	Enable-SWXLog

	$server = New-SWServer -host $addr -port $port -user $user -password $password

	$server.Connect()
    
	$firstNode = new-Object Node

	$firstNode.HostName = $addr
	$firstNode.ImagePath = $imagePath
	$firstNode.ImageName = $imageName
	$firstNode.Size = $size
	$firstNode.CreateImage = $createImage
	$firstNode.TargetAlias = $targetAlias
	$firstNode.AutoSynch = $autoSynch
	$firstNode.SyncInterface = $syncInterface
	$firstNode.HBInterface = $hbInterface
	$firstNode.PoolName = $poolName
	$firstNode.SyncSessionCount = $syncSessionCount
	$firstNode.ALUAOptimized = $aluaOptimized
	$firstNode.SectorSize = $sectorSize
	$firstNode.CacheMode = $cacheMode
	$firstNode.CacheSize = $cacheSize
	$firstNode.FailoverStrategy = $failover
    $firstNode.CreateTarget = $createTarget

	$secondNode = new-Object Node

	$secondNode.HostName = $addr2
	$secondNode.HostPort = $port2
	$secondNode.Login = $user2
	$secondNode.Password = $password2
	$secondNode.ImagePath = $imagePath2
	$secondNode.ImageName = $imageName2
	$secondNode.CreateImage = $createImage2
	$secondNode.TargetAlias = $targetAlias2
	$secondNode.AutoSynch = $autoSynch2
	$secondNode.SyncInterface = $syncInterface2
	$secondNode.HBInterface = $hbInterface2
	$secondNode.SyncSessionCount = $syncSessionCount2
	$secondNode.ALUAOptimized = $aluaOptimized2
	$secondNode.CacheMode = $cacheMode2
	$secondNode.CacheSize = $cacheSize2
	$secondNode.FailoverStrategy = $failover
    $secondNode.CreateTarget = $createTarget2

	$thirdNode = new-Object Node

	$thirdNode.HostName = $addr3
	$thirdNode.HostPort = $port3
	$thirdNode.Login = $user3
	$thirdNode.Password = $password3
	$thirdNode.ImagePath = $imagePath3
	$thirdNode.ImageName = $imageName3
	$thirdNode.CreateImage = $createImage3
	$thirdNode.TargetAlias = $targetAlias3
	$thirdNode.AutoSynch = $autoSynch3
	$thirdNode.SyncInterface = $syncInterface3
	$thirdNode.HBInterface = $hbInterface3
	$thirdNode.SyncSessionCount = $syncSessionCount3
	$thirdNode.ALUAOptimized = $aluaOptimized3
	$thirdNode.CacheMode = $cacheMode3
	$thirdNode.CacheSize = $cacheSize3
	$thirdNode.FailoverStrategy = $failover
    $thirdNode.CreateTarget = $createTarget3




   

###---------------
    
    $server = New-SWServer -host $addr -port $port -user $user -password $password

	$server.Connect()

     #create image file
	New-ImageFile -server $server -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize -header "test"

	$device
    
	#create target
    #echo $target = New-Target -server $server -alias $targetAlias -devices $device.Name
	$target = New-Target -server $server -alias $targetAlias -devices $device.Name
    

	$target
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}


###---------------
try
{
	Enable-SWXLog
    $server2 = New-SWServer -host $addr2 -port $port -user $user -password $password
    echo "Serveur 2"
	$server2.Connect()

     #create image file
	New-ImageFile -server $server2 -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server2 -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize -header "test"

	
    
	#create target
	$target = New-Target -server $server2 -alias $targetAlias2 -devices $device.Name


}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server2.Disconnect()
}

try
{
	Enable-SWXLog
    $server3 = New-SWServer -host $addr3 -port $port -user $user -password $password

	$server3.Connect()

     #create image file
	New-ImageFile -server $server3 -path $filePath -fileName $fileName -size $size
    
	#create device
	$device = Add-ImageDevice -server $server3 -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize -header "test"

	$device
   
	#create target
	$target = New-Target -server $server3 -alias $targetAlias3 -devices $device.Name

	#$target
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server3.Disconnect()
}



    $device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -thirdNode $thirdNode -initMethod $initMethod
    #echo  $device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -thirdNode $thirdNode -initMethod $initMethod

	$syncState = $device.GetPropertyValue("ha_synch_status")

	while ($syncState -ne "1")
	{
		#
		# Refresh device info
		#
		$device.Refresh()

		$syncState = $device.GetPropertyValue("ha_synch_status")
		$syncPercent = $device.GetPropertyValue("ha_synch_percent")

		Start-Sleep -m 2000

		Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
	}


catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon Apr 25, 2022 2:52 pm
by yaroslav (staff)
Hi,

Please make sure to add the correct interfaces. It might appear that you are typing the "local" IP addresses where the script implies the partner IP addresses to be listed.

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon Apr 25, 2022 3:12 pm
by kaderb
Hi Yaroslav,

Thanks for this quick answer.

My 3 servers are directly connected for sync ans iscsi ports and for each server .

FOr each server, i have put for Sync and HB is partner.

Perharps my syntax is not good?

For instance, the first node :
$syncInterface=$("#p2={0}:3260;#p3={1}:3260" -f $addr_sync_2_21,$addr_sync_3_23)
$hbInterface=$("#p2={0}:3260;#p3={1}:3260" -f $addr_iscsi_2_11,$addr_iscsi_3_13)
I want that the result of $syncInterface are : "172.16.21.20","172.16.23.30" and for $hbInterface : 172.16.11.20 , 172.16.13.30

Is that correct?

Regards


Kader


Image

Re: Powershell + Starwind VSAN for Vsphere

Posted: Tue Apr 26, 2022 1:22 pm
by yaroslav (staff)
Greetings,

There is indeed a problem with syntax.
Please fill in the gaps of the script and make sure to type PARTNER IP addresses, not LOCAL ones.

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon May 16, 2022 12:34 pm
by kaderb
Hi,
Thanks for your answer.
All is configured.
Anyway the devices still not synchronized and I don't understand why.

When I try using the script SyncHaDevice.ps1 to launche a sync, this error is returned :

Code: Select all

PS C:\WINDOWS\system32> C:\Program Files\StarWind Software\StarWind\StarWindX\Samples\powershell\SyncHaDevice.ps1
Synchronize device HAImage1
Failed to perform synchronization (1) from 
-
control 0x00000000000F7A00 -Synchronize: -SynchronizationType:"1"
-
200 Failed: can't find available or valid partner for synchronization.. 

Here's the detail of a HaDevice of the Target :

Code: Select all

Name                    : HAImage1
DeviceType              : HA Image
DeviceId                : 0x00000000000F7A00
File                    : VSA Storage\mnt\disk1\masterImg31_HA.swdsk
TargetName              : iqn.2008-08.com.starwindsoftware:57.7.10.42-targetha31
TargetId                : 0x00000000000F9600
Size                    : 12582912
CacheMode               : none
CacheSize               : 0
CacheBlockExpiryPeriod  : 0
Exists                  : True
DeviceLUN               : 0
IsSnapshotsSupported    : False
Snapshots               : 
SectorSize              : 512
State                   : 0
Parent                  : 
Partners                : System.__ComObject
SynchronizationChannels : 
HeartbeatChannels       : 
SyncStatus              : 3
SyncPercent             : 0
IsWaitingAutosync       : False
SyncTrafficShare        : 50
NodeType                : 1
FailoverStrategy        : 0
MaintenanceMode         : 0

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon May 16, 2022 12:50 pm
by yaroslav (staff)
Could you kindly tell me if the initial synchronization was ever completed? Please also show the script that you used.

Re: Powershell + Starwind VSAN for Vsphere

Posted: Mon May 16, 2022 2:15 pm
by kaderb
Hi Yaroslav,

The intial sync was never been comleted, loop in 0%

Here's the script :

Code: Select all

param($addr="57.7.10.42", $port=3261, $user="root", $password="starwind",
	$addr2="57.7.10.43", $port2=$port, $user2=$user, $password2=$password,
	$addr3="57.7.10.44", $port3=$port, $user3=$user, $password3=$password,
#common
	$initMethod="Clear",
	$size=12,
	$sectorSize=512,
	$failover=0,
#primary node
	$imagePath="VSA Storage\mnt\disk1",
	$imageName="masterImg31",
	$createImage=$true,
	$targetAlias="targetha31",
	$autoSynch=$true,
	$poolName="pool1",
	$syncSessionCount=1,
	$aluaOptimized=$true,
	$cacheMode="",
	$cacheSize="",
	$syncInterface=$("#p2=172.16.21.20:3260;#p3=172.16.23.30:3260" -f $addr2;$addr3 ),
	$hbInterface=$("#p2=172.16.11.20:3260;#p3=172.16.13.30:3260"-f $addr2;$addr3),
#secondary node
	$imagePath2="VSA Storage\mnt\disk1",
	$imageName2="partnerImg32",
	$createImage2=$true,
	$targetAlias2="partnerha32",
	$autoSynch2=$true,
	$poolName2="pool1",
	$syncSessionCount2=1,
	$aluaOptimized2=$false,
	$cacheMode2=$cacheMode,
	$cacheSize2=$cacheSize,
	$syncInterface2=$("#p1=172.16.21.10:3260;#p3=172.16.22.30:3260" -f $addr;$addr3 ),
	$hbInterface2=$("#p1=172.16.11.10:3260;#p3=172.16.12.30:3260" -f $addr;$addr3 ),
#third node
	$imagePath3="VSA Storage\mnt\disk1",
	$imageName3="partnerImg33",
	$createImage3=$true,
	$targetAlias3="partnerha33",
	$autoSynch3=$true,
	$poolName3="pool1",
	$syncSessionCount3=1,
	$aluaOptimized3=$false,
	$cacheMode3=$cacheMode,
	$cacheSize3=$cacheSize,
	$syncInterface3=$("#p1=172.16.23.10:3260;#p2=172.16.22.20:3260" -f $addr;$addr2),
	$hbInterface3=$("#p1=172.16.13.10:3260;#p2=172.16.12.20:3260" -f $addr;$addr2)
	)

Import-Module StarWindX

try
{
	Enable-SWXLog

	$server = New-SWServer -host $addr -port $port -user $user -password $password

	$server.Connect()
    
	$firstNode = new-Object Node

	$firstNode.HostName = $addr
	$firstNode.ImagePath = $imagePath
	$firstNode.ImageName = $imageName
	$firstNode.Size = $size
	$firstNode.CreateImage = $createImage
	$firstNode.TargetAlias = $targetAlias
	$firstNode.AutoSynch = $autoSynch
	$firstNode.SyncInterface = $syncInterface
	$firstNode.HBInterface = $hbInterface
	$firstNode.PoolName = $poolName
	$firstNode.SyncSessionCount = $syncSessionCount
	$firstNode.ALUAOptimized = $aluaOptimized
	$firstNode.SectorSize = $sectorSize
	$firstNode.CacheMode = $cacheMode
	$firstNode.CacheSize = $cacheSize
	$firstNode.FailoverStrategy = $failover

	$secondNode = new-Object Node

	$secondNode.HostName = $addr2
	$secondNode.HostPort = $port2
	$secondNode.Login = $user2
	$secondNode.Password = $password2
	$secondNode.ImagePath = $imagePath2
	$secondNode.ImageName = $imageName2
	$secondNode.CreateImage = $createImage2
	$secondNode.TargetAlias = $targetAlias2
	$secondNode.AutoSynch = $autoSynch2
	$secondNode.SyncInterface = $syncInterface2
	$secondNode.HBInterface = $hbInterface2
	$secondNode.SyncSessionCount = $syncSessionCount2
	$secondNode.ALUAOptimized = $aluaOptimized2
	$secondNode.CacheMode = $cacheMode2
	$secondNode.CacheSize = $cacheSize2
	$secondNode.FailoverStrategy = $failover

	$thirdNode = new-Object Node

	$thirdNode.HostName = $addr3
	$thirdNode.HostPort = $port3
	$thirdNode.Login = $user3
	$thirdNode.Password = $password3
	$thirdNode.ImagePath = $imagePath3
	$thirdNode.ImageName = $imageName3
	$thirdNode.CreateImage = $createImage3
	$thirdNode.TargetAlias = $targetAlias3
	$thirdNode.AutoSynch = $autoSynch3
	$thirdNode.SyncInterface = $syncInterface3
	$thirdNode.HBInterface = $hbInterface3
	$thirdNode.SyncSessionCount = $syncSessionCount3
	$thirdNode.ALUAOptimized = $aluaOptimized3
	$thirdNode.CacheMode = $cacheMode3
	$thirdNode.CacheSize = $cacheSize3
	$thirdNode.FailoverStrategy = $failover

	$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -thirdNode $thirdNode -initMethod $initMethod 
    
	$syncState = $device.GetPropertyValue("ha_synch_status")

	while ($syncState -ne "1")
	{
		#
		# Refresh device info
		#
		$device.Refresh()

		$syncState = $device.GetPropertyValue("ha_synch_status")
		$syncPercent = $device.GetPropertyValue("ha_synch_percent")

		Start-Sleep -m 2000

		Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
	}
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}

Re: Powershell + Starwind VSAN for Vsphere

Posted: Tue May 17, 2022 5:07 pm
by yaroslav (staff)
Please contact us at support@starwind.com using this thread and 695379 as your references.