Configurie using Powershell

Software-based VM-centric and flash-friendly VM storage + free version

Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)

Post Reply
min4er
Posts: 5
Joined: Thu Mar 22, 2018 5:32 pm

Sat May 05, 2018 8:24 am

Hello!
I am new to VSAN Free, and I try simply to connect to serrver using PowerShell:

Import-Module StarWindX
$server = New-SWServer 127.0.0.1 3261 root starwind
$server.Connect()

Output is
StarWindX doesn't support current appartment. You need to run this script with
-STA switch to use StarWindX.

... and other errors

When I do PowerShell -NoExit -STA D:\Connect.ps1
Output is
The term ' New-SWServer' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At D:\Connect.ps1:3 char:26
+ $server = New-SWServer <<<< -host 127.0.0.1 -port 3261 -user root -passwo
rd starwind
+ CategoryInfo : ObjectNotFound: (New-SWServer) [], Com
mandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Exception You cannot call a method on a null-valued expression.

What I am doing wrong?
Sekkmer
Posts: 29
Joined: Thu Mar 08, 2018 12:11 pm

Sat May 05, 2018 9:58 am

If you search for Powershell in the start menu you should find a "StarWindX Powershell" that should start the Powershell in the correct mode shown below:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -sta -NoExit -command "& set-strictMode -version 2.0; Import-Module StarWindX"

If you still get errors make sure that you installed StarWind with "StarWindX Powershell" correctly.
min4er
Posts: 5
Joined: Thu Mar 22, 2018 5:32 pm

Sat May 05, 2018 10:28 am

$server = New-SWServer 127.0.0.1 3261 root starwind
$server.Connect()

Script runs now, but nothing happens
Sekkmer
Posts: 29
Joined: Thu Mar 08, 2018 12:11 pm

Sat May 05, 2018 12:35 pm

well, that's expected you just connected to a server and do nothing else if you want to do something more complicated than there are a lot of helpful examples here:

C:\Program Files\StarWind Software\StarWind\StarWindX\Samples\powershell
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Mon May 07, 2018 10:32 am

Sekkmer is correct. Just connecting to the server and doing nothing afterwards shall not give any significant result. So, be sure the check the PowerShell examples folder that is a part of StarWind VSAN installation.
min4er
Posts: 5
Joined: Thu Mar 22, 2018 5:32 pm

Mon May 07, 2018 2:33 pm

Thank you!
Connection is successful.
I was sure that I`ll see any changes in GUI, but it was a mistake. As it turned out, сhanges, made with Powershell work silently.
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Mon May 07, 2018 7:59 pm

When working with StarWind VSAN via PowerShell, you generally perform the same operations, but using different means. Which in turn means no special notification is made in GUI about any actions, unless the results are expected to be seen, like new device creation etc.
Post Reply