PowerShell GUI VMware and FlashArray Storage Management Tool

Here is my storage manager for the FlashArray and VMware. Based on PowerCLI, but uses a front end GUI. Enjoy!

NOTICE THIS HAS BEEN DEPRECATED IN FAVOR OF THE POWERSHELL MODULE HERE:
https://www.codyhosterman.com/scripts-and-tools/pure-storage-powershell-vmware-module/

There are a variety of methods of managing VMware objects (VMFS volumes, VMs, VMDKs and RDMs) and the underlying snapshots to recovery or clone them. But often I get asked if I have a PowerShell (PowerCLI) script to do one or all of them. I have a bunch on my GitHub, but I decided a week or so ago to put something a bit more robust together. At first I was making it a standard interactive script, but it morphed into a GUI, using combo-boxes etc:

Version 2.8.0

Added support for:

  • Adding a new ESXi host to a host group (iSCSI or FC)

Version 2.7.0

Added support for:

  • Add datastores to protection groups
  • Create protection group snapshots
  • Delete protection group snapshots
  • Recover datastores and VMs from protection group snapshots

Blog post here:

VMware and FlashArray PowerShell GUI tool v2.7

Version 2.5.1

Added support for:

  • PowerCLI 6.5.1. Will detect if PowerCLI is installed and will attempt to install it from the PowerShell Gallery if possible.

Version 2.5.0:

Added support for:

  • iSCSI configuration (creates software adapter (if needed), adds FlashArray iSCSI targets and disables delayedAck and sets login timeout to 30 second on those targets
  • Host Group Creation
  • Multipathing on ESXi configuration

Version 2.0.0:

Added support for:

  • Multiple FlashArrays
  • VMFS Provisioning
  • VM recovery to different datastore
  • VMDK cloning to different VM
  • RDM cloning to different VM
  • Snapshot deletion
  • VM deletion
  • VMDK deletion
  • RDM deletion
  • Tabbed management
  • General improvements

Version 1.0.1:

  • Fixed an issue where it disconnects from vCenter with the error:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.   
  • Added scroll bars that appear to allow it to fit inside windows with lower resolution

Version 1.0.0:

NOTE: Please read this post in detail before use! It restores and removes VMs depending on the operation, so read this to understand what is going to happen before running it.

So, what does this tool do? A few things. It allows you to manage the follow objects:

  • VMFS
  • Virtual Machine
  • Virtual Disk (VMDK)
  • Raw Device Mapping (RDM)

At a high level, you can restore any one of these objects from a FlashArray snapshot of your choosing (or create a new snapshot). You can also spin up a copy of that object. There are a few options to change the behavior of the operation. Let’s walk through it.

Configuration

The first thing you need to do is to download the tool. You can get it here:

https://github.com/codyhosterman/powercli/blob/master/PureStorageVMwareStorageTool.ps1

Next make sure PowerCLI 6.3 R1 or later is installed as well as the Pure Storage PowerShell SDK 1.7 or later is installed. Now, just run the ps1 file.

This tool changes some PowerCLI variables, so run the tool as administrator.

The next step is to authenticate the vCenter and a FlashArray. Add in your vCenter credentials and your FlashArray credentials (as well as their IP or FQDN) and click connect respectively. Doesn’t matter what order you connect.

You can disconnect and connect to a new FlashArray or vCenter at anytime. In this release, connections to only one vCenter and one FlashArray at a time is supported. To connect to a different FlashArray, for instance, click disconnect and re-enter the connection info for the different array.

Once connect to both, the remaining options will populated as they become available. The first box is about what object do you want to deal with, a VMFS, a virtual machine, a virtual disk, or a RDM? Choose the proper radio button. You can always switch at any time. Furthermore, when you choose the object and go to select it, if you have a large environment, the drop-down could be huge. So there are two filters available for you; filter by VMware cluster or by object name. Choose neither, both, or just one. If you are recovering a VMFS, it will be the datastore name, for everything else, it is the VM name. The cluster drop-down will pull in all of the cluster names in your vCenter (filtered by your vCenter permissions of course).

I am going to look for a VM in my cluster named “SJ-Infrastructure” that has a name including “app”. The search is case-insensitive.

Once, chosen, click the “Get Datastores or “Get Virtual Machines” and choose the recovery object. In the next four sections, I will describe the workflow, based on first VMFS, then Virtual Machine, then Virtual Disk, and then finally RDM.

VMFS Recovery

Once, you have connected to vCenter and the FlashArray, choose VMFS as the option. This will enable the “Get Datastore” button. Depending on your filters, it will return all or a subset of the datastores in your vCenter. Choose the datastore you want. Also, choose a cluster. This will be the cluster that a copy of the datastore will be provisioned to.

The datastore option only has one workflow. Choose a snapshot and then bring up a copy of that datastore from the point-in-time of that snapshot.

Virtual Machine Recovery

Once, you have connected to vCenter and the FlashArray, choose “Virtual Machine” as the option. This will enable the “Get Virtual Machines” button. Depending on your filters, it will return all or a subset of the VMs in your vCenter. Choose the VM you want.

There are two recovery options, you can select both, neither or just one.

The behavior will be as such depending upon your selections:

  • Neither option is checked: This will bring up a copy of the datastore that the VM sits on from the snapshot you choose. The VM will then be registered from that copied datastore with the original name plus a suffix to make it unique from the original. In the first release, the VM will be added to the same cluster as the original VM. It will not be powered on, to prevent network interference.
  • Only “Replace original VM/VMDK/RDM” is selected: In this case, the copied datastore will be brought up from the chosen snapshot and the VM will be registered with a temporary name. The original VM will be deleted. The copied VM will be renamed back to the original name and powered on. It will remain on the copied VMFS.
  • Only “Storage vMotion back to the source VMFS” is selected. This will bring up a copy of the datastore that the VM sits on from the snapshot you choose. The VM will then be registered from that copied datastore with the original name plus a suffix to make it unique from the original. The VM will then be Storage vMotioned to the original datastore. If the copied datastore is then clear of any registered VMs (it should be unless someone manually put on one it) it will be unmounted, detached from all hosts and then destroyed on the FlashArray. The VM will not be powered-on to prevent network collisions.
  • Both options are selected. In this case, the copied datastore will be brought up from the chosen snapshot and the VM will be registered with a temporary name. The original VM will be deleted. The copied VM will be renamed back to the original name and powered on. The VM will then be Storage vMotioned to the original datastore. If the copied datastore is then clear of any registered VMs (it should be unless someone manually put on one it) it will be unmounted, detached from all hosts and then destroyed on the FlashArray.

Note that in the initial version, for full VM recovery only VMs that are on only one datastore will be supported. For virtual disk and RDM recovery, the VM can be spread across as many datastores as needed.

Virtual Disk Recovery

Once, you have connected to vCenter and the FlashArray, choose “Virtual Disk” as the option. This will enable the “Get Virtual Machines” button. Depending on your filters, it will return all or a subset of the VMs in your vCenter. Choose the VM you want.

Quick thanks to @ikiris for this following post, really helped me for this part:

http://blog.chrischua.net/2015/06/23/change-vmdk-uuid-using-powercli/

Once a virtual machine has been chosen, the virtual disks will be listed. This will show the virtual disk path and the size. Choose the virtual disk you want to recover.

There are two recovery options, you can select both, neither or just one.

The behavior will be as such depending upon your selections:

  • Neither option is checked: This will bring up a copy of the datastore that the virtual disk sits on from the snapshot you choose. The virtual disk will then be added from that copied datastore to the VM. The virtual disk will be given a new, unique UUID so it does not interfere with the original virtual disk . It will be added to the same virtual SCSI controller as the original disk.
  • Only “Replace original VM/VMDK/RDM” is selected: In this case, the copied datastore will be brought up from the chosen snapshot. The source virtual disk will be removed and deleted from the datastore and the recovered virtual disk will be added to the VM in the same controller as the original. It will remain on the copied VMFS.
  • Only “Storage vMotion back to the source VMFS” is selected. This will bring up a copy of the datastore that the virtual disk sits on from the snapshot you choose. The virtual disk will then be added from that copied datastore to the VM. The virtual disk will be given a new, unique UUID so it does not interfere with the original virtual disk . It will be added to the same virtual SCSI controller as the original disk.The virtual disk will then be Storage vMotioned to the original datastore. If the copied datastore is then clear of any registered VMs (it should be unless someone manually put on one it) it will be unmounted, detached from all hosts and then destroyed on the FlashArray. The VM will not be powered-on to prevent network collisions.
  • Both options are selected. This will bring up a copy of the datastore that the virtual disk sits on from the snapshot you choose. The source virtual disk will be removed and deleted from the datastore and the recovered virtual disk will be added to the VM in the same controller as the original. The recovered virtual disk will then be Storage vMotioned to the original datastore. If the copied datastore is then clear of any registered VMs (it should be unless someone manually put on one it) it will be unmounted, detached from all hosts and then destroyed on the FlashArray. The VM will not be powered-on to prevent network collisions.

This release only supports recovering the original VMDK to the VM or a point-in-time copy of the VMDK to the original VM. Adding it to a different VMDK will be a feature in the future.

Raw Device Mapping Recovery

Once, you have connected to vCenter and the FlashArray, choose “Raw Device Mapping” as the option. This will enable the “Get Virtual Machines” button. Depending on your filters, it will return all or a subset of the VMs in your vCenter. Choose the VM you want.

Once a virtual machine has been chosen, the RDMs will be listed. This will show the RDM NAA and the size. Choose the RDM you want to recover.

 

There is only one recovery option for RDMs.

The behavior will be as such depending upon your selections:

  • No option is checked: This will bring up a new volume from the chosen snapshot of the chosen RDM. It will be added to the same virtual SCSI controller as the original RDM of the same VM.
  • Only “Replace original VM/VMDK/RDM” is selected: In this case, the RDM will be temporarily removed from the VM and then the corresponding FlashArray volume will be refreshed from the chosen snapshot. The RDM will be added back to the identical SCSI slot and controller of the VM.

Choosing a Snapshot

The last step is choosing a snapshot, or creating a new one. If you want to create a new one, enter a new snapshot name and click the “Create Snapshot” button. If the name is valid, and the object is on the connected FlashArray the snapshot will be created and the name reported.

A new snapshot:

If you already have a snap, or want to use that one, go to the last box and click “Gather Snapshots”. This will list all of the available snapshots that host that VMFS, VM, VMDK, or RDM. It will list the snapshot name and time stamp.

Once you have chosen a snapshot, and are sure you are ready, click the “Execute” button. This operation can take some time, so be patient. The tool cannot be used during an operation and may go unresponsive during certain operations. That is normal–just let it finish.

Logging

The tool has a operation logging and error logging box at the bottom. Encountered errors or log messages will appear there.

Next Steps…

That’s it! Please let me know any feedback. Also, depending on how long your rescans are and if you choose storage vMotion, it can take some time to complete. So, be patient and let it run, it might be unresponsive during certain PowerCLI operations.

 

28 Replies to “PowerShell GUI VMware and FlashArray Storage Management Tool”

  1. Hi Cody

    i am Bulent from Turkey.ASP partner TAra Sistem

    i get error message like this how can i fix that while runing scripts

    2/14/2017 2:34:47 PM Get-Datastore Could not establish trust relationship for the SSL/TLS secure channel with authority ‘xxx.xxx.xxx.xxx.

    1. I have seen this intermittently myself as well. I am not entirely sure why though. I have a suspicion that is might have to do with this:
      Set-PowerCLIConfiguration -invalidcertificateaction “ignore” -confirm:$false |out-null

      Could you remove that line from the script (it is line 47) and let me know if the problem persists?

      In the short term, just disconnect and re-connect to the vCenter with the buttons. Though let me know if the above suggestion helps.

  2. I’m sure it something simple but can you help?

    I’m running VMware vSphere PowerCLI 6.3.0 R1 Patch 1 & Release 1.7.4.0 PurePowerShellSDKInstaller.msi, but when I run the PureStorageVMwareRecoveryTool.ps1 (as admin) I get this:

    PS C:\PURE> C:\PURE\PureStorageVMwareRecoveryTool.ps1
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:115 char:13
    + <a href="/open-source" class="js-selected-navigation-item …
    + ~
    The '<' operator is reserved for future use.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:117 char:13
    + <a href="/business" class="js-selected-navigation-item na …
    + ~
    The '<' operator is reserved for future use.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:119 char:13
    + <a href="/explore" class="js-selected-navigation-item nav …
    + ~
    The '<' operator is reserved for future use.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:121 char:13
    + <a href="/pricing" class="js-selected-navigation-item nav …
    + ~
    The '<' operator is reserved for future use.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:123 char:11
    +
    + ~
    The ‘<input name="utf8" type="hidden" value="✓" …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:7353 char:11
    + © 2017 <span title="0.33992s from github-fe119-cp1-prd …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:7353 char:23
    + © 2017 <span title="0.33992s from github-fe119-cp1-prd …
    + ~
    The '<' operator is reserved for future use.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:7353 char:29
    + … 2017 GitHub’ in expression or statement.
    At C:\PURE\PureStorageVMwareRecoveryTool.ps1:7353 char:100
    + … 992s from github-fe119-cp1-prd.iad.github.net”>GitHub, Inc.</l …
    + ~
    Missing argument in parameter list.
    Not all parse errors were reported. Correct the reported errors and try again.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

  3. There almost seems like text has been copied from the entire web page and then saved as a ps1 file. Did you right click and save as from the source page (which is kind of what it looks like because the word “github” or “open source” is not in my code) or did you go to:

    https://github.com/codyhosterman/powercli/blob/master/PureStorageVMwareRecoveryTool.ps1

    And then copy from the text box? Or you can go directly here and just copy everything:

    https://raw.githubusercontent.com/codyhosterman/powercli/master/PureStorageVMwareRecoveryTool.ps1

    Let me know if that helps!

  4. hello cody, nice tools,

    but when i login to my pure it keep give me error please let me know how to fix this error. thanks

    The term ‘New-PfaArray’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    Connection to FlashArray 172.17.x.x failed. Please check credentials or IP/FQDN

  5. Hello cody, Great tool thanks a lot .. Before i try it, i would like to check with you if this will be able to help me on my case.

    We have a production server on PURE with two vmdks, that once a month we need to stop the database and take a snapshot of the vmdk2 of 2.5TB (live). Then we mount this snapshot and present it to a different server for testing purpose. No changes needs to be made on the Production server other than the snapshot.

    Do you think this will be possible? Any idea how long will take the process to take a snapshot of this 2.5TB vmdk?
    Thank you in advance.

  6. You’re welcome!

    Well if you use FlashArray snapshots of the VMFS that stores the VMDK, it will take milliseconds regardless of the size–=since it is just a metadata copy.

    The tool will allow you to restore or mount a copy of a VM, a VMDK, an RDM or an entire VMFS from a snapshot. Or create a snapshot of the volume that hosts that object.

    Today the tool only allows recovering or cloning the VMDK/RDM back to the same VM. Though I plan on adding the functionality to add it to a different VM soon. You can use the datastore recovery portion though to bring the datastore copy up to any cluster, Then you can add the copied VMDK on the copied datastore to any VM using the normal means in vCenter.

  7. Have you thought of adding all this functionality (and this one –
    PureStorageVMwareRecoveryTool) into the PURE vcenter plugin so its a single pain of glass and we didn’t have to bounce out of vCenter to do backups/restores? No non-hardware array software company (that I know of) can handle RDM’s at the vmware level. The restore functionality of RDM’s (and pointer files) at the vmware layer form the array snapshot level is PURE GOLD (pardon the pun)!!!!

    1. Never need to apologize for a good pun 🙂 Yeah we are planning on adding a lot of this, as we certainly have gotten the requests. I built this mainly as a stop-gap until the plugin has the ability

  8. Cody, awesome tool! Thank you!

    However I cant seem to see any replicated snapshots, only the source snaps are available. I am connected to both arrays? Is this functionality missing? Trying to use this tool instead of buying SRM….

    1. You’re welcome!! I haven’t added remotely replicated snapshots into it yet. But I can! I will add it to my list for the next version.

        1. Sure thing! Though I would not recommend using this for disaster recovery, for if the first site is down, it will not be able to identify snapshots etc. SRM is a much better solution for this.

          1. I will work on it. Right now nothing is tested for DR scenarios, so I doubt it will work. But I will see what I can do.

  9. Getting the following error when attempting recovery of a volume from snapshot with this tool.

    1/11/2018 1:59:22 PM [{“pure_err_key”: “err.friendly”, “code”: 6, “ctx”: “*”, “pure_err_code”: 1, “msg”: “Volume does not exist.”}]

    Note: Running Purity 5.0

    1. Hmm. I know this was an issue with Purity versions before 4.7 (didnt support wildcards). It should be fine now. What exact workflow are you trying to do?

  10. Great tool Cody. Especially for a new Pure user like myself. This will come in very handy.

    I was following your video on youtube and was working with recovering under the Protection Group Recovery tab. I get an error:
    Could not find an unresolved VMFS volume for FlashArray volume ***. Exiting process and deleting volume copies.

    I could see the snap being recovered in Pure but it would error out before vSphere could see it I guess.

    I was able to successfully recover a snap under the VMFS Management tab. It finished successfully and I was able to see the files under the newly added VMFS datastore in vSphere. Wonder why it would error out on the Protection Group tab?

    Thanks,
    Dal

    1. Glad to hear! My guess is maybe the pgroup has non-VMFS volumes in it (RDMs or simply non-VMware ones). I didn’t write it to handle that situation. Is that the case?

      1. Hey Cody. All of our volumes are VMFS6. We only have VMWare datastores using the PURE volumes. I only have 1 volume in each pgroup. No special circumstances. Just volumes on pure, in a pgroup and a datastore for that volume on the VMware side.

        Dale

        1. Sorry I’ve been so slow to reply. I’ve been traveling. Do you mind opening a Support ticket? Have them reach out to me next week when I’m in the office and they can setup a web meeting and we can take a look

  11. Cody,

    Quick question, I’m running version 2.8.0 and SDK 1.7.4, everything works except the option to create a new Snapshot. I’m able to restore previously created snaps but i cant create new ones from your script.. Any idea why? this function used to work on your first versions.

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.