Updated UNMAP PowerCLI Script for FlashArrays


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:, and

Enter them into line 35 like so:

$flasharrays = @("","","")

If you just have one FlashArray it will look like:

$flasharrays = @("")

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:


8 Replies to “Updated UNMAP PowerCLI Script for FlashArrays”

    1. I do need to add better error handling into it, thats for sure. But currently besides the log there isn’t much of a better option to find out. What kind of failure are you running into?

      1. We were able to figure it out – permission issue. I’m not sure why the service account I used worked well for 2-3 months and then randomly stopped on 1/5/2015.

        1. Ah I think support pinged me on this. Good to hear things worked out, but strange to hear things changed suddenly. If you have any feedback on how I can improve this to help with this issue you had please let me know.

  1. Thank you for your work on this. Im looking to implement this script with PowerActions, should I be able to copy and paste the unmap.ps1 script @ GitHub, into a PowerActions script, and it work correctly after changing the variables for our environment?


      1. Cody,

        Yeah, I saw that post as well, which is why I asked the above. It seemed like there were some changes you had to make to be able to run it thru PowerActions. I’m a Linux Admin, but was asked to help out on this, so Ill see if I can figure out where and what changes I need to make to the unmap.ps1 script to get it to work in PowerActions.


        1. If you don’t mind waiting I can do some of this work for you. Might be a week or so though. I’d be happy to help over email too. cody AT pure storage dot com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.