Skip to end of metadata
Go to start of metadata

If you want to operate a CoprHD installation from a Windows server using Microsoft Powershell commands or scripts, you will find these instructions useful. A link to a powershell package for CoprHD is included below.

Step-by-step guide


  1. Download and unzip the "PS.ZIP" file on to your server – a Windows Server 2012 R2 machine (or any other system which has Powershell 4.0 or later)

  2. Copy the folder ViPRPSModule to the system Powershell directory.

  3. Open PowerShell 4.0 and then say


    Import-Module “ViPRPSModule.psd1”
  4. How to get help on individual commands: Get-Help Set-ViPRGlobalConnectionFields -Full




A sample script is given below. This can be run directly from the powershell command line.

Assumes: user: root; password= "Password!";  volume size = 5GB, volume name=ps-demo

Create Volume Sample

$ViPRHost = ""
$vUser = "root"
$vPWord = ConvertTo-SecureString –String "Password!" –AsPlainText -Force
$vc = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $vUser, $vPWord
Set-ViPRGlobalConnectionFields -ViPRHost $ViPRHost -Credential $vc -IgnoreSSLErrors $true
$ai = Get-ViPRVirtualArray
$ai = $ai[1]
$pi = Get-ViPRBlockVirtualPool
$pi = $pi[0]
$projectname = "my_project"
$project = Get-ViPRProject -Name $projectname
$project = $project[0]
$v = New-ViPRVolume  -SizeInGB 5GB -VirtaulArrayId $ -BlockVirtualPoolId $ -ProjectId $ -Name ps-demo
Expand-ViPRVolume -Volume $v -NewSize 2GB
Remove-ViPRVolume -Volumes $v


Host Provisioning sample

$hostName = "win-2012-host"
$hosts = Get-ViPRHostSystem -Name $hostName
$varrayName = "my_varray"
$array = Get-ViPRVirtualArray -Name $varrayName
$poolName = "my_vpool"
$pool = Get-ViPRBlockVirtualPool -Name $poolName
$projectname = "my_project"
$project = Get-ViPRProject -Name $projectname
$project = $project[0]
$sizeGB = "5"
$fstype = "NTFS"
$volumelabel = "ps-demo"
$order = New-ViPRHostVolume -StorageType "exclusive" -HostId $ -VirtualArrayId $ `
-VirtualPoolId $ -ProjectId $ -VolumeName $volumelabel -SizeGB $sizeGB `
-FilesystemType "ntfs"
Wait-ViPROrder -OrderId $
Wait-ViPROrder -OrderId $
$volume = Get-ViPRVolume -Name $volumelabel
$ro = Remove-ViPRHostVolume -StorageType "exclusive" -HostId $ -VolumeId $
Wait-ViPROrder -OrderId $

Some commands and their meanings


Set-ViPRGlobalConnectionFieldsTo set the connection parameters
Get-ViPRVirtualArrayGet virtual arrays
Get-ViPRBlockVirtualPoolGet block virtual pools
New-ViPRVolumeCreate volume
Expand-ViPRVolumeExpand Volume
Remove-ViPRVolumeRemove Volume
New-ViPRHostVolume Create volume for a host 
Remove-ViPRHostVolume Remove volume for a host 

1 Comment

  1. What versions of CoprHD will these scripts work with?