QuantaStor PowerShell Command Reference: Difference between revisions
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== PowerShell installation methods == | == PowerShell installation methods == | ||
PowerShell is supported on [https:// | PowerShell is supported on [https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux Windows, Linux, and Mac]. In addition to system packages and snaps provided by Microsoft, it can also be installed with a functioning recent [https://learn.microsoft.com/en-us/dotnet/core/install/linux dotnet SDK] as a global tool (Recommended if you already have the .NET SDK installed): | ||
dotnet tool install --global PowerShell | dotnet tool install --global PowerShell | ||
If you do not have the .NET Core SDK installed and are on a much older version, then you can | If you do not have the .NET Core SDK installed and are on a much older version, then you can review the 'Install PowerShell on Windows' instructions and download the installation MSI [https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.3#msi/ found here]. | ||
https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.3#msi | |||
==== Recommended versions ==== | ==== Recommended versions ==== | ||
Line 11: | Line 10: | ||
To check what version you have installed, execute the following command from a PowerShell console: | To check what version you have installed, execute the following command from a PowerShell console: | ||
'''$PSVersionTable''' | '''$PSVersionTable''' | ||
Example version output: | |||
PS C:\Program Files\PowerShell\7> $PSVersionTable | |||
Name Value | |||
---- ----- | |||
PSVersion 7.3.0 | |||
PSEdition Core | |||
GitCommitId 7.3.0 | |||
OS Microsoft Windows 10.0.19045 | |||
Platform Win32NT | |||
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} | |||
PSRemotingProtocolVersion 2.3 | |||
SerializationVersion 1.1.0. | |||
== QuantaStor PowerShell module installation == | == QuantaStor PowerShell module installation == | ||
Line 22: | Line 35: | ||
For example, | For example, | ||
PS /> $Env:QSPath = "http://10.0.8.242" | PS /> $Env:QSPath = "http://10.0.8.242" | ||
PS /> $Env:QSLogin = "exampleUser:abcd1234" | PS /> $Env:QSLogin = "exampleUser:abcd1234" | ||
== Commands == | == Commands == |
Latest revision as of 17:40, 11 August 2023
PowerShell installation methods
PowerShell is supported on Windows, Linux, and Mac. In addition to system packages and snaps provided by Microsoft, it can also be installed with a functioning recent dotnet SDK as a global tool (Recommended if you already have the .NET SDK installed):
dotnet tool install --global PowerShell
If you do not have the .NET Core SDK installed and are on a much older version, then you can review the 'Install PowerShell on Windows' instructions and download the installation MSI found here.
Recommended versions
To use the QuantaStor PowerShell module, you must be on PowerShell 7 or newer and dotnet 6 or newer.
To check what version you have installed, execute the following command from a PowerShell console: $PSVersionTable
Example version output:
PS C:\Program Files\PowerShell\7> $PSVersionTable Name Value ---- ----- PSVersion 7.3.0 PSEdition Core GitCommitId 7.3.0 OS Microsoft Windows 10.0.19045 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.
QuantaStor PowerShell module installation
Our module is hosted on the PowerShell gallery and can be found here. Installation is easily done through PowerShell:
Install-Module -Name QuantaStor.PowerShell
Environment Variables
There are two current environment variables QSPath
and QSLogin
. Unless set, QSPath
is http://localhost/
. Commands for setting these variables in PowerShell are below:
$Env:QSPath = "http://x.x.x.x:y" $Env:QSLogin = "username:password"
For example,
PS /> $Env:QSPath = "http://10.0.8.242" PS /> $Env:QSLogin = "exampleUser:abcd1234"
Commands
The commands can be slightly renamed from other instances to be closer to PowerShell standards. For example instead of UserEnum
there is Enum-User
. All commands can be listed with:
Get-Command -Module QuantaStor.PowerShell
And help for a command can be viewed with:
Get-Help COMMAND
For example to view the parameters of Add-User
:
Get-Help Add-User
To list all users:
Enum-User
To list all storage pools:
Enum-StoragePool