Page 1 of 1

Configurie using Powershell

Posted: Sat May 05, 2018 8:24 am
by min4er
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?

Re: Configurie using Powershell

Posted: Sat May 05, 2018 9:58 am
by Sekkmer
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.

Re: Configurie using Powershell

Posted: Sat May 05, 2018 10:28 am
by min4er
$server = New-SWServer 127.0.0.1 3261 root starwind
$server.Connect()

Script runs now, but nothing happens

Re: Configurie using Powershell

Posted: Sat May 05, 2018 12:35 pm
by Sekkmer
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

Re: Configurie using Powershell

Posted: Mon May 07, 2018 10:32 am
by Boris (staff)
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.

Re: Configurie using Powershell

Posted: Mon May 07, 2018 2:33 pm
by min4er
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.

Re: Configurie using Powershell

Posted: Mon May 07, 2018 7:59 pm
by Boris (staff)
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.