Thursday, December 15, 2016

Create your own PowerShell Modules

If you are coding in PowerShell, most likely you have been using modules.  If you are using the Netapp Ontap PowerShell toolkit, you certainly know the line "Import-Module DataOntap".

So you can probably guess that importing a module is just loading someone else's code.  A module, when professionally written is most likely "compiled" code.  Code written C# or another .NET language and compiled into a DLL.  In Visual Studio you can create PowerShell projects.  Does that mean, if you want you own module, you need to start learning Visual Studio and C# ?  Hell no, you can create your own module in matter of minutes with nothing more that just plain old PowerShell.

Friday, December 9, 2016

Powershell Logging - The professional way

I've seen many PowerShell scripts in my career.  Fantastic ones and awful ones.  But I have very very rarely seen scripts where proper logging has been done.  Everyone seems to know write-output.  The clever ones know write-verbose and write-warning.  Some are really smart and write their own logging functions, allowing some level of customization.

But...

If you really want to show off with your logging, you need the full monty.  You want screen logging, rolling log files with automated time-stamps and you want event viewer logging.  Obviously, you want to have control of what and when.

Thursday, December 8, 2016

Invoke workflow with Perl and REST

Ever heard of REST ?  In a nutshell : REST is a way of talking to a remote 'system' using existing standards.  http(s) as the protocol and json or xml as the carrier.  Reading is a GET, Writing is a POST.

Oh, and did you know WFA has a REST api ?  That's right, you can talk to WFA with about any programming language there is.

I'm a powershell / .NET guy, so I'll post a powershell sample ASAP.  But I just saw this nice piece of PERL code from my colleague Todd and couldn't wait sharing.  I guess Todd won't mind :), and hopefully he'll add some more comment to this article.

Incremental Naming

I had a discussion yesterday about incremental naming.  A discussion that started after my post about reservations and verifications.
My colleague stated that reservations are not needed for the incremental naming to work and that rather the verification had a bigger role in it.

It ended up in a debate where both have a point.  So how does incremental naming work ?

Monday, December 5, 2016

Tutorial : Move all volumes from one aggregate to another

Whether it's for a migration or a Non-disruptive operation.  Every once in a while, you might need to clean out an entire aggregate and move all the volumes to one or more aggregates.  Those volume moves can take a while, and you don't want them all running at the same time.  Maybe you want only 1 at a time, or maybe 2.  I've created a workflow that does exactly that.  Using an excel file as input and a datasource to collect the vol move information.  In this tutorial we will go over all the bits and pieces, including reservations, custom datasources, importing excelfiles and repeat rows.

WFA and reservations, what is it and how does it work ?

If you know a little about WFA, you probably know that WFA gets all his information from external sources.  Most of the time, it gets its information from OnCommand Unified Manager (OCUM).  Now OCUM, re-scans its information every 15 minutes.    After that re-scan, you still need to wait for the WFA re-scan to happen.  Agreed, you can configure OCUM to update the WFA cache database right after its own refresh (reducing the LAG-time), but you will always have a potential 15 minutes LAG.  So how can WFA work around that problem ?  That's what you will learn in this article.

Friday, December 2, 2016

WFA Command to install a Root CA Certificate on a SVM

For a customer I had to create SVM's and join them in AD.  However, the Active Directory Server was using a public certificate.  Thus, to be able to join the SVM in AD, we first had to install the Root CA certificate on the SVM.  A troublesome manouvre if you have to it manually with the CLI.  Since were provisioning with WFA, why not just create a command to do this.  The customer also has lots of site and DC's, so we added the functionality to set the preferred DC as well.
Below is the code, but I've also added the DAR file.