***********UPDATE PLEASE REFER TO THE POST AT THIS LINK FOR UPDATED INFORMATION ON THIS SCRIPT***********************
Quick update. I have posted a new version of the PowerCLI UNMAP script that I maintain. I usually do not put a blog post out every time I update it, but there were enough changes here I think it was worth a quick note.
The biggest change is that fact that I have a new version of the script called unmapsdk that no longer makes direct REST calls to the FlashArray but instead uses the Pure Storage PowerShell SDK that is freely available for customers and partners here:
Huge thanks to my coworker Barkz for very quickly helping me convert the former script into a SDK based one. Because of the SDK, it is now much cleaner and simpler to understand than making direct REST calls with invoke-restmethod. I will be focusing all enhancements on that script version from now on most likely. I will keep both up on my GitHub though. They are in feature parity right now though (September 28th, 2015). Both versions have the following changes.
Most notably the script supports multiple FlashArrays present in the same vCenter. The script can now handle the configuration of multiple connections to different FlashArrays in the $flasharrays variable.
I used to just have a $purevip variable, but the way it was managed it could only hold one FlashArray and the connection management for the REST calls had the same issue. So now enter them into the $flasharrays variable as a hash table.
So if you have three FlashArrays and their IPs are the following:
192.168.1.120, 192.168.1.130 and 192.168.1.140
Enter them into line 35 like so:
$flasharrays = @("192.168.1.120","192.168.1.130","192.168.1.140")
If you just have one FlashArray it will look like:
$flasharrays = @("192.168.1.120")
Also, they still share the same user name and password in this script. I will add multi-password handling in the future if this comes up as a problem. So just enter the credentials once.
The REST API version is now using 1.4, so any FlashArray running Purity 4.1.x or later will be fine. You really should be running those code levels anyways.
To sum up, these are the requirements:
- (SDK version only) Pure Storage PowerShell SDK must be installed
- PowerShell 3.0 or later
- PowerCLI 6.0 Release 1 or later (5.5/5.8 is likely fine, but not tested with this script version)
- REST API 1.4 and later
- Purity 4.1 and later
- FlashArray 400 Series or //m
- vCenter 5.5 and later
- Each FlashArray datastore must be present to at least one ESXi version 5.5 or later host or it will not be reclaimed
Check it out!
Direct REST version:
Pure Storage PowerShell SDK version: