VMware Solutions Discussions

NetApp VSC Powershell Toolkit

datacenterdude
22,141 Views

All,

Some of you are familiar with our previous "kamino" powershell cmdlets/module.  The problem with that is that is was focused on one particular functional area of VSC:   Provisioning & Cloning.

That simply does not scale well.

So we went back to the drawing board, and did some renaming of the code.

Caveats:

  • Functionally, these are identical actions to the previous kamino cmdlets.
  • We have renamed things to be more generic, or all-encompassing, as we begin down the path of adding APIs for many tasks in the VSC.
  • We understand that many of you already have scripts in place using the older stuff, but please understand, all you need to change is the module that gets loaded, and the cmdlet names used.

Going forward:

  • As we add new APIs to VSC, we will also be adding equivalent cmdlets for that functionality.

If you have any questions, or run into any issues with the toolkit/module, please post them here!

Usage:

PS> Import-Module C:\Path-to-DLL\NetAppVSC.dll

PS> Get-Command -Module NetAppVSC

CommandType     Name

-----------     ----

Cmdlet          Connect-vsc

Cmdlet          Get-vscManagedObjectRef

Cmdlet          Get-vscVirtualMachine

Cmdlet          Get-vscVmFileSpec

Cmdlet          New-vscControllerSpec

Cmdlet          New-vscDatastore

Cmdlet          Remove-vscDatastore

Cmdlet          Set-vscDatastoreSize

Cmdlet          Start-vscClone

Cmdlet          Start-vscRedeploy

Thanks!

UPDATE:  Due to some inconsistencies we have found with the .dll (we think compiling corruption on the final build) we've pulled this down temporarily so that it doesn't proliferate further, and will get a new version up ASAP.  Please remember that this isn't something officially sanctioned by NetApp, but something that 1 or 2 of us are doing in our spare time.  Thank you for your patience, and we'll get it back very soon, I promise!

UPDATE: I am posting the original rebranded toolkit!  Please let know how this works!


-Nick

35 REPLIES 35

danieljlucas
18,917 Views

I have VSC 4.1 installed on our vCenter Server 4.1 U3 box. Will this toolkit allow me to create scripts for cloning out a development environment of several VMs? Do you know of any documentation or example scripts to get me started? I noticed there is no documentation in the zip file.

Thanks,

Daniel

elic_co
18,917 Views

Hey,

I'm unable to import this module to use it with powershell, I think that is because it is missing some files like the module manifest, and file that define the types..

Can you upload the full powershell module or explaine how can I use the files I have downloaded here?

Thank you,

Chen.

AENETAPPUSER
18,917 Views

What Chen said!

PJATSUNCORP
18,917 Views

+1 What Chen said!

I think there's some stuff missing...

You're zip file is just the NetAppVSC.dll file...

The Connect-VSC cmdlet doesn't work... The Kamino version does:

The type initializer for 'com.netapp.vsc.cmdlets.Connectvsc' threw an exception.

PJATSUNCORP
18,917 Views

Hi there,

Is there any doco on these cmdlets outside of the Get-Help options in PowerShell?

We're having issues with vCenter and VSC 4.1, the main one being an issue with the bootsPerMinute option breaking when we try to create clones.

Thanks

Pete

datacenterdude
18,917 Views

Hey guys,

Thanks for the feedback!  Just wanted to let you know that we're checking into this and will get a new version up soon!

-Nick

PJATSUNCORP
18,917 Views

Hi Nick,

Thanks for the reply. Do you have a rough eta? Also, can you make sure that it has the bootsperminute thing included in it?

Thanks

Pete

datacenterdude
18,917 Views

UPDATE:  Due to some inconsistencies we have found with the .dll (we think compiling corruption on the final build) we've pulled this down temporarily so that it doesn't proliferate further, and will get a new version up ASAP.  Please remember that this isn't something officially sanctioned by NetApp, but something that 1 or 2 of us are doing in our spare time.  Thank you for your patience, and we'll get it back very soon, I promise!

DLVIRTUALSERVERS
18,916 Views

Good Day!


First off, thank you for doing this in your spare time.  Scripting these kinds of tasks saves everyone time once the scripts are written.


My question: I am looking for a way to "Set Recommended Values" (Open NetApp tab in vCenter -> Right Click Host -> Set Recommended Values) via a script.  Would this PowerShell toolkit allow for that setting?


Alternatively, I can set the advanced settings with the VMware PowerCLI, but my concern is there is something being set with the "Set Recommended Values" that I would be missing by setting the advanced settings manually.


Thank you again for your efforts in creating this Powershell toolkit.  It is very much appreciated and I look forward to seeing the updated link.

datacenterdude
13,715 Views

DL,

Not yet.  This is a baseline Toolkit that we basically rebuilt from the legacy 'kamino' kit some of you may remember, which only contained the few pieces with APIs already from Provisioning & Cloning.  We also added some new .cs files for the vCloud APIs, which I think is where we ran into problems.

The M&HC section is going to have some APIs that we'll be able to code against (either C# or PS directly) so once those are there, we'll be able to do what you're after.

My hold up currently is trying to mess around with Windows 8, and lost a hard drive in my laptop that had my Windows 7 VM (with my Visual Studio) so trying to get all that rebuilt so we can continue.

-Nick

ewilts_mc
13,715 Views

Since our corporate standard will be to migrate from agent-based backups to VSC-based snapshots, are there plans to be able to script any pieces of the Backup and Recovery component?

Are there any plans to formalize and support the PowerShell toolkit or will this continue to be an unsupported add-on?

Thanks!

datacenterdude
13,715 Views

ewilts,

There IS a hidden cli that we like to call 'smvicli' where you can execute some things against the VSC service to trigger backup workflows.  You can find any and all documentation on this in in Install and Admin Guide.

As far as the powershell toolkit is concerned, there are no APIs for it yet, so nothing for us to extend unfortunately.  It is something that will come in the future, but we are currently in a bit of a transition period where we're moving from the thick C# vSphere client to the Web GUI.   I think once we see how things come together with the webGUI, adding an underlying WSDL to write powershell against will be pretty straight-forward.   Seemingly all about time and patience right now.

As far as I know, none of NetApp's powershell addon's/Toolkits fall into the "supported" bracket, even though they're all used very heavily. 

datacenterdude
13,715 Views

All, please note that the original package has been re-added to the first post.  This is simply the re-branding effort of the original kamino toolkit, as stated, and look for further updates as we add more functionality/APIs into the VSC!

Sorry for taking so long to get this back out here!  Some extreme circumstances took place.

-Nick

aaw
13,715 Views

Hey Nick,

Quick question, I have an unknown controller that is marked as Skipped that we cant removed I have tried, unsetting the Skipped value, tried right click Delete Controller and get an alert saying you cannot delete this controller.

I was wondering, is there a way to remove an unknown, skipped controller? I found a perlscript to remove hosts from vCenter when they are on zombie state and was hoping the Toolkit may have a command to remove controller or something that will allow me to remove it for good!!!

PS: This is not a NetApp controller, it was a CentOS server running NFS that we mounted a while ago so we could copy some virtual machines while rebuilding the host hosting these VMS.

Thanks!!!

Carol

mbeattie
13,911 Views

Hi All,

*Note that you would need to update "10.61.167.168" with your VSC IP Address in the NetAppVSC.dll.config file.

        <com.netapp.vsc.Properties.Settings>

            <setting name="NetApp_vsc_ApiImplService" serializeAs="String">

                <value>https://10.61.167.168:8143/kamino/public/api</value>

            </setting>

            <setting name="NetApp_vsc_ApiImplService" serializeAs="String">

                <value>https://10.61.167.168:8143/kamino/public/api</value>

            </setting>

        </com.netapp.vsc.Properties.Settings>

        <com.netapp.vsc.Properties.Settings>

            <setting name="NetApp_vsc_ApiImplService" serializeAs="String">

                <value>https://10.61.167.168:8143/kamino/public/api</value>

            </setting>

        </com.netapp.vsc.Properties.Settings>

Regardless of updating the IP it still got a 404 using this .dll (even though the object exists, can be browsed in the vcenter MOB and connected to via kamino).

Get-vscManagedObjectRef : The request failed with HTTP status 404: Not Found.

At line:1 char:24

+ Get-vscManagedObjectRef <<<<  "Sydney" Datacenter

    + CategoryInfo          : InvalidOperation: (com.netapp.vsc.vscServer:vscServer) [Get-vscManagedObjectRef], WebExc

   eption

    + FullyQualifiedErrorId : ApiError,com.netapp.vsc.cmdlets.GetvscManagedObjectRef

The Kamino module works EG:

PS C:\> import-module kamino
PS C:\> Connect-Kamino -VCenterHost $ipAddress -Credential $credentials


VCenterHostname    : XX.XX.XX.XX
VCenterAddress     : XX.XX.XX.XX
VCenterCredentials : System.Net.NetworkCredential
ServiceHostname    :
ServiceAddress     : XX.XX.XX.XX
VCenterVersion     : 5.1.0

PS C:\> Get-KaminoManagedObjectRef "Sydney" Datacenter
Datacenter:datacenter-2

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

kambara
12,308 Views

Hi mbeattie,

Thanks for helpful message.

After I modified NetAppVSC.dll.config file as you wrote, HTTP 404 error was disappeared successfully.

But when I try to run any other command-let like Get-vscManagedObjectRef, it shows HTTP 403 Forbidden...

I checked https://vsc:8143/Register.html and creating SSL keystore correctly. And entered correct address, username and password to connect-vsc.

Are there any other setting for authentication?

mbeattie
12,308 Views

Hi Toyohiko,

Sounds like a credential issue. Try this changing the %variable% for your environment

Import-Module C:\Windows\System32\WindowsPowerShell\v1.0\modules\VSC\NetAppVSC.dll
$ipAddress   = "xx.xx.xx.xx"
$username    = "%domainname%\%username%"
$credentials = Get-Credential -Credential $username
Connect-vsc -vCenterHost $ipAddress -Credential $credentials

Assuming your credentials are correct you should be able to alteas connect,  then "in theory" you should be do something like this;

Get-vscManagedObjectRef "%datacenterName%" Datacenter

*Note I have NOT been able to successfully get any object reference using this .dll file. Works in the Kamino module in VSC2.X, not with this .dll in VSC4.X. EG:

import-module kamino
$ipAddress   = "xx.xx.xx.xx"
$username    = "%domainname%\%username%"
$credentials = Get-Credential -Credential $username
Connect-Kamino -VCenterHost $ipAddress -Credential $credentials

VCenterHostname    : xx.xx.xx.xx
VCenterAddress     : xx.xx.xx.xx
VCenterCredentials : System.Net.NetworkCredential
ServiceHostname    :
ServiceAddress     : xx.xx.xx.xx
VCenterVersion     : 5.1.0

Get-KaminoManagedObjectRef "%datacenterName%" Datacenter
Datacenter:datacenter-2

I'm trying to develope my own functions in powershell to work with VSC4.X using web services. EG...

[String]$ipAddress  = "xx.xx.xx.xx"
[Int]$portNumber    = 8143
[String]$username   = "%domainname%\%username%"
[String]$uri        = "https://$ipAddress`:$portNumber/kamino/public/api?wsdl"
$credentials        = Get-Credential -Credential $username
$proxy              = New-WebServiceProxy -uri $uri -namespace WebServiceProxy -Credential $credentials
$proxy | gm

# Note the methods are exposed here. EG

#getMoref Method string getMoref(string arg0, string arg1, WebServiceProxy.requestSpec, ebmdvg-g, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null arg2)

*In theory one would assume you can send SOAP messages using this API to start cloning tasks...though others have run into trouble with that too

https://communities.netapp.com/message/106361#106361

I'm trying to get in touch with the developers, i'll let you know what i find out.

Cheers Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

kambara
12,308 Views

Dear Matt,

Thanks for replying.

> *Note I have NOT been able to successfully get any object reference using this .dll file. Works in the Kamino module in VSC2.X, not with this .dll in VSC4.X. EG:

Oh.... I understood.

I'm just trying the way as same as you wrote via using New-WebServiceProxy.

My environment is vSphere/vCenter 5.1 and VSC 4.2 with PowerShell 2.0.

Fortunately, I successfully got connecting kamino, and get the list of WebService method and others.

However, to call "createClone" method needs really complexed procedures.

And I couldn't find the way to create xxxSpec element correctly.

> I'm trying to get in touch with the developers, i'll let you know what i find out.

Yes, please.

And thanks again, it's really helpful of me.

Followings are my draft script.

## ===================================================================================================

## Parameters

##

$VscIpAddress = "10.130.202.171";

$VscPortNumber = "8143";

$VscUser = "administrator";

$VscPassword = "P@ssw0rd";

$VscUri  = "https://$VscIpAddress`:$VscPortNumber/kamino/public/api?wsdl";

$VcenterIpAddress = "10.130.202.171";

$VcenterUri = "https`://$VcenterIpAddress/sdk";

## ===================================================================================================

## Create Secure Credential Object

##

$SecureVscPassword = ConvertTo-SecureString $VscPassword -AsPlainText -Force;

$VscCredential = new-Object System.Management.Automation.PSCredential($VscUser, $SecureVscPassword);

## ===================================================================================================

## Ignore SSL Error

##

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};

## ===================================================================================================

## Main

##

try {

    $VscProxy = New-WebServiceProxy -Uri $VscUri -Namespace VscRcu;

}

catch {

    Write-Error $_ -ErrorAction:`SilentlyContinue`;

}

$VscProxy | Get-Member;

mbeattie
12,113 Views

For anyone following this thread...please see the following link for an alternate solution

https://communities.netapp.com/thread/30999

Cheers Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

aaw
12,097 Views

Guys,

I have an unknown controller that is marked as Skipped that we cant removed I have tried, unsetting the Skipped value, tried right click Delete Controller and get an alert saying you cannot delete this controller.

I was wondering, is there a way to remove an unknown, skipped controller? I found a perlscript to remove hosts from vCenter when they are on zombie state and was hoping the Toolkit may have a command to remove controller or something that will allow me to remove it for good!!!

PS: This is not a NetApp controller, it was a CentOS server running NFS that we mounted a while ago so we could copy some virtual machines while rebuilding the host hosting these VMS.

Thank you!!!

Public