Microsoft Virtualization Discussions

SDCLI - PowerShell Wrapper

christoph
6,862 Views

Hi,

I'd like to share a thought about the current Snapdrive implementation of SDCLI. Currently there is (as far as i know) no support for direct access of snapdrive through powershell (plz correct me if i'm wrong). But I needed a way to get the disk list of a server to be able to do some crazy stuff with dataontap powershell toolkit. (like kicking in qtree snapmirror on all connected volumes, stuff like this)

as far as i see there is no easy way to get all output of sdcli to a powershell object so I tried it myself and would be happy if anybody may give me a hint if what i do is the right way or if there is a much easier way to accomplish what i'd like to do.

it's sort of a sdcli powershell wrapper..

BG Christoph

$output = &sdcli.exe disk list

$LoopCounts = $output.Count/25

$DiskList = @()

for ($i=0;$i -lt $LoopCounts;$i++)

{

    #Write-Host $i

   

    $Disk =  New-Object PSObject -Property @{

        UNCPath                     = ($output[$i].split(":",2))[1].trim()

        LUNPath                     = ($output[$i+1].split(":",2))[1].trim()

        StorageSystem               = ($output[$i+2].split(":",2))[1].trim()

        StorageSystemPath           = ($output[$i+3].split(":",2))[1].trim()

        Type                        = ($output[$i+4].split(":",2))[1].trim()

        DiskSerialNumber            = ($output[$i+5].split(":",2))[1].trim()

        BackedbySnapshotCopy        = ($output[$i+6].split(":",2))[1].trim()

        Shared                      = ($output[$i+7].split(":",2))[1].trim()

        BootOrSystemDisk            = ($output[$i+8].split(":",2))[1].trim()

        SCSIport                    = ($output[$i+9].split(":",2))[1].trim()

        Bus                         = ($output[$i+10].split(":",2))[1].trim()

        Target                      = ($output[$i+11].split(":",2))[1].trim()

        LUN                         = ($output[$i+12].split(":",2))[1].trim()

        Readonly                    = ($output[$i+13].split(":",2))[1].trim()

        Size                        = ($output[$i+14].split(":",2))[1].trim()

        SnapmirrorSource            = ($output[$i+15].split(":",2))[1].trim()

        SnapvaultPrimary            = ($output[$i+16].split(":",2))[1].trim()

        DiskPartitionStyle          = ($output[$i+17].split(":",2))[1].trim()

        CloneSplitRestorestatus     = ($output[$i+18].split(":",2))[1].trim()

        DiskID                      = ($output[$i+19].split(":",2))[1].trim()

        VolumeName                  = ($output[$i+20].split(":",2))[1].trim()

        Mountpoints                 = ($output[$i+21].split(":",2))[1].trim()

        IPAddresses                 = ($output[$i+22].split(":",2))[1].trim()

        iSCSIinitiator              = ($output[$i+23].split(":",2))[1].trim()

    }

   

    $DiskList += $Disk

   

}

$DiskList | fl

1 ACCEPTED SOLUTION

cknight
6,862 Views

Hi, Christoph.  No, SDW doesn't include PowerShell integration.  Have you tried Get-NaHostDisk and Get-NaHostVolume in Data ONTAP PowerShell Toolkit 1.6 or later?

View solution in original post

6 REPLIES 6

cknight
6,863 Views

Hi, Christoph.  No, SDW doesn't include PowerShell integration.  Have you tried Get-NaHostDisk and Get-NaHostVolume in Data ONTAP PowerShell Toolkit 1.6 or later?

christoph
6,862 Views

Thanks for the info, but the problem is not to get information about the disk the problem is to run a script on a windows machine and do the following steps:

- get all luns connected to the windows machine which we are running on

- create SDW consistent snapshot on this machine

- update the qtree snapmirror with the created snapshot as a base

i don't want to configure the script every time, there should be as much intelligence as possible to get all necessary information not configure it through any type of configuration file or so.... As far as i understand there should be everything on the machine itself to get the job done.

SDCLI creates the consistent snapshot

SDCLI can get the disk with source filer and volume path (which i try to give some professional look with creating a powershell way to get the necessary information)

DataOntap Toolkit should be able to connect to the source filer, get the corresponding snapmirror connection

use the information from the snapmirror connection to update the snapmirror with base snapshot on the destination filer

(as far as i know the snapmirror update trigger needs to be done on the destination filer or ?)

BG Christoph

bsti
6,862 Views

I had the same need.  I ended up writing my own PoSH cmdlets to perform those functions.

christoph
6,862 Views

as far as i found the tipp with get-nahostdisk does expose all functionality i needed.

JBRUNS2012
6,862 Views

Anything you would like to share?

bsti
6,862 Views

Perhaps in the near future.  I have quite a bit of company-specific code wrapped up in it.  I'm in the process of slowly separating that out.  For the most part, I just cmdletized the sdcli command line. 

Public