Overview
This is a PowerShell module to manage VAST systems.
This beta version of the PowerShell module is limited with a minimal set of commands - new commands will be add based on feedback, so let us know what you would like to include!
Installation
- Download the attached zip file
VastPS.zip (6.8 KB) - Extract the zip file into a directory ( e.g
c:\vast)
Configuration
Before starting to use the module you need to edit the config.json file
and edit the below parameters
Name - The name of the cluster (endpoint)
Host - The hostname or IP address of the VMS
User - A user that can authenticate with the vast cluster
Password - Above user’s password
config.js example:
{
"Name": "vast-1",
"Host": "https://HOST-NAME/api/",
"User": "user",
"Password": "password"
},
{
"Name": "vast-2",
"Host": "https://HOST-NAME/api/",
"User": "user",
"Password": "password"
}
]
Module installation
- Open powershell as administrator
- Run import command:
import-module c:\vast\VastPS.psd1 -verbose
Note that the default location for the configuration file isc:\vast\however you can change it by editing the PSM1 file and adjust this section:
#Path to your config.json file
$jsonPath = "C:\vast\config.json"
The command should run with no errors or warnings.
In some cases the PowerShell execution policy is set to strict and needs to be adjusted for the import to work. If you are working in such an environment run the below command in the PowerShell console. (Make sure to coordinate this action with your company security officer, as needed.)
Set-ExecutionPolicy Unrestricted -Scope CurrentUse
NOTE - For old Windows systems that were have not updated in a long time, an update might be required
Securing the connection
For security reasons one may prefer to encrypt the password in the config file so it wont be saved as plain text. This can be achieved by using the encrypt.ps1, after importing the new module run the encrypt.ps1 script in a PowerShell console with admin rights.
To decrypt the password, run the decrypt.ps1 file from a PowerShell console. The password will be shown on screen for all endpoints.
PS C:\vast> .\decrypt.ps1
Endpoint: v136, Decrypted Password: 123456
Endpoint: v101, Decrypted Password: 123456`
If you are using encryption it is recommended to move the decryption script to a secure location.
If you wish to skip writing the passwords in a file you can specify username and password directly in the command-line as in the below example.
PS C:\vast> Get-vips_list -Endpoint v136 -username admin -password 123456 | ft
id guid name url title ip vippool cnode cluster hostname
-- ---- ---- --- ----- -- ------- ----- ------- --------
206 15363aad-e5dc-555c-9332-98f8dd897108 https://v136/api/vips/206/ 172.21.136.13 172.21.136.13 vippool-3 cnode-128-7 v136 v136cn3
207 d6e29e11-c8a5-5222-a869-77b40079e235 https://v136/api/vips/207/ 172.21.136.14 172.21.136.14 vippool-3 cnode-128-7 v136 v136cn3
208 da9e7e01-0e7f-531d-9d41-20a3faf65632 https://v136/api/vips/208/ 172.21.136.15 172.21.136.15 vippool-3 cnode-128-5 v136 v136cn1
209 4e9d992f-3226-5d8f-9597-bc10992bfa7c https://v136/api/vips/209/ 172.21.136.12 172.21.136.12 vippool-3 cnode-128-5 v136 v136cn1
210 947144cd-b542-511b-b205-45d4692ba416 https://v136/api/vips/210/ 172.21.136.11 172.21.136.11 vippool-3 cnode-128-7 v136 v136cn3
201 c2805109-4a58-5581-82cb-c7cdb5cb2490 https://v136/api/vips/201/ 172.21.136.10 172.21.136.10 vippool-2 cnode-128-5 v136 v136cn1
204 f897f5d8-74cf-5c47-a8c3-779ddb7296e3 https://v136/api/vips/204/ 172.21.136.8 172.21.136.8 vippool-2 cnode-128-5 v136 v136cn1
203 5c8e8317-a783-5a22-8c59-94930acdc6b4 https://v136/api/vips/203/ 172.21.136.9 172.21.136.9 vippool-2 cnode-128-7 v136 v136cn3
202 f3448810-a6e8-511a-aa29-c724e20d373d https://v136/api/vips/202/ 172.21.136.7 172.21.136.7 vippool-2 cnode-128-7 v136 v136cn3
205 38837d1a-0366-5b59-8d59-8c993182dc4d https://v136/api/vips/205/ 172.21.136.6 172.21.136.6 vippool-2 cnode-128-7 v136 v136cn3
211 4ecb7183-4fa0-50fc-844c-04a3df5a9151 https://v136/api/vips/211/ 172.21.136.17 172.21.136.17 vippool-4 cnode-128-5 v136 v136cn1
212 69726d7c-bd0c-5ca9-adfe-1e2c1d978915 https://v136/api/vips/212/ 172.21.136.19 172.21.136.19 vippool-4 cnode-128-5 v136 v136cn1
213 89b7b772-8449-5ec5-b42d-1780d556dc91 https://v136/api/vips/213/ 172.21.136.18 172.21.136.18 vippool-4 cnode-128-7 v136 v136cn3
214 e6b6ab26-5a42-52c2-a68e-8932032c8507 https://v136/api/vips/214/ 172.21.136.20 172.21.136.20 vippool-4 cnode-128-7 v136 v136cn3
215 78c21595-fe9f-593f-8b7b-983c59c7cf49 https://v136/api/vips/215/ 172.21.136.16 172.21.136.16 vippool-4 cnode-128-7 v136 v136cn3
96 297070b5-c834-5966-9063-de7fe7fd4ead https://v136/api/vips/96/ 172.21.136.5 172.21.136.5 vippool-1 cnode-128-7 v136 v136cn3
6 11af4a74-68ce-510b-9cd2-eb4bf7765384 https://v136/api/vips/6/ 172.21.136.3 172.21.136.3 vippool-1 cnode-128-6 v136 v136cn2
9 60f44267-7bff-5e7d-a6ab-d401640c57b6 https://v136/api/vips/9/ 172.21.136.4 172.21.136.4 vippool-1 cnode-128-5 v136 v136cn1
101 9565fc98-b4fc-57db-a76d-a06c2ff9eea8 https://v136/api/vips/101/ 172.21.136.1 172.21.136.1 vippool-1 cnode-128-7 v136 v136cn3
61 7f3f093a-74a0-5f6d-a6e8-c5ca107da648 https://v136/api/vips/61/ 172.21.136.2 172.21.136.2 vippool-1 cnode-128-5 v136 v136cn1Usage examples
Usage examples
The module usage is similar to standard Cmdlets.
List all supported commands:
Get-Command -Module vastps
Create new view (NFS)
New-VastView -Endpoint v136 -path /test-view -protocols NFS -policy_id 1 -create_dir $true -alias /test-view
Create new view (SMB)
New-VastView -path "/smb-view" -protocols "SMB" -policy_id 4 -create_dir $true -share "smb-share" -endpoint "v101"
List views
Get-views_list -Endpoint v136
You can also use powershell expectable flag such as ft
Get-views_list -Endpoint v136 | ft
Initiate hardware check
Invoke-VastHardwareCheck -Endpoint v136
Uninstall
To uninstall the module run the below command:
Remove-Module -Name vastps
Quick demo recording
Additional Examples:
CreateUserShare.ps1 (2.0 KB)
CreateMissionShares.ps1 (3.3 KB)
Demo recording (no audio) of the 2 example scripts: CreateUserShare.ps1 and CreateMissionsShares.ps1:
And lastly, two scripts that work together to create 40 views for some VMware testing, and then a script that uses VMwareCLI PowerShell set to mount those various views.
VMware-CreateDatastores.ps1 (1.6 KB)
CreateVMwareViews.ps1 (2.0 KB)