Unsolved
This post is more than 5 years old
1 Rookie
•
7 Posts
0
1180
June 28th, 2019 01:00
Create an ScVolume object in Powershell?
Hi,
I am writing a script that should display all snpshots created on a volume. The user should select one of them and then th§e script should create a ViewVolume based on that selection. (I have a consistensy group so I need 2 volumes to be mounted, one Data volume and one Log volume)
I have used Grid-view to create display the list of snapshots and let the user select which snapshot to use.
But the result of the grid-view output is that the variable becomes a:
$SnapshotD.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSCustomObject System.Object
Because of that I am not able to use this variable type when I want to continue to work with it towards DELL Storage Manager.
So I wounder how I can type so that the result of grid-view comes out as a ScVolume type object (see example here):
$VolumeL.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False ScVolume DellStorage.Api.Config.DellStorageApiBaseStorageCenterObject
My script now looks like this:
$ConnName = "DSMDC"
$ScName = "´compellent name"
$ScVolumeFolderPath = "/volumefolderpath/"
$VolumeNameD = "volumename 1"
$VolumeNameL = "volumename 2"
$VolumeD = Get-DellScVolume -ConnectionName $ConnName `
-ScName $ScName `
-VolumeFolderPath $ScVolumeFolderPath `
-Name $VolumeNameD
$VolumeL = Get-DellScVolume -ConnectionName $ConnName `
-ScName $ScName `
-VolumeFolderPath $ScVolumeFolderPath `
-Name $VolumeNameL
$SnapshotD =Get-DellScReplay -ConnectionName $ConnName `
-ScName $ScName `
-CreateVolume $VolumeD `
-Active:$false `
| Sort-Object -Descending { [datetime]$_.FreezeTime }, `
{ [UInt32] ( $_.GlobalIndex.Split( "-" ) )[-1] } |Out-GridView -Title "Select SNAPSHOT to workwith" -OutputMode Single |Select *
$FreezetimeL = $SnapshotD.Freezetime
$SnapshotL = Get-DellScReplay -ConnectionName $ConnName -ScName $ScName -CreateVolume $VolumeL -Active:$false | Select-Object -Property Freezetime,InstanceName | Where-Object Freezetime -EQ $FreezetimeL
$ViewVolumeY =New-DellScReplayView -ConnectionName $ConnName -Instance $SnapshotL.InstanceName -Name $ViewVolumeNameL -VolumeFolder $VolumeL.VolumeFolder


DELL-Bob Mi
2 Intern
•
230 Posts
0
July 6th, 2019 16:00
Hello ATEAGunnar,
I do not have access to a Compellent system to test any commands so I can only help you so much.
I had previously created a script to output all of the help files for every PowerShell API SDK command for reference. This is what I had used when I had previously assisted users trying to figure out commands. Here is the script which I had extracted the SDK in to directory API:
Import-Module "C:\API\DellStoragePowerShellSDK-4.2.0.7\DellStorage.ApiCommandSet.psd1"
$user = "Admin"
$em = "127.0.0.1"
$pass = ConvertTo-SecureString "xxxxx" -AsPlainText -Force
$conn = Connect-DellApiConnection -HostName $em -User $user -Password $pass
$CMD = Get-Command -Module DellStorage.ApiCommandSet
foreach ($line in $CMD)
{
Write Host $line
$line | %{Get-Help $_.Name -Detailed} | Out-File C:\API\Help4.2.0.7\$line.txt
}
3 commands I was looking at from the help files were these:
NAME - Get-DellScReplayConsistencyGroupReplayListAssociation
SYNOPSIS - Gets a list of Replays created by the Consistency Group
NAME - Get-DellScReplayProfileConsistencyGroupListAssociation
SYNOPSIS - List of Consistency Groups created by the Replay Profile
NAME - Get-DellScReplay
SYNOPSIS - Gets a list of Objects
I feel that in this line you need to select the InstanceID for the Snapshot you want to create the View Volume from.
$VolumeL -Active:$false | Select-Object -Property Freezetime,InstanceName | Where-Object Freezetime -EQ $FreezetimeL