The following are some of my PowerCLI scripts that are on my GitHub page and a quick overview. Some of these scripts I update quite frequently and those have their own blog posts with updates.
https://github.com/codyhosterman/powercli
VMware ESXi Space Reclamation (UNMAP) and the FlashArray
Blog Post:
Pure Storage FlashArray UNMAP PowerCLI Script for VMware ESXi
Script:
https://github.com/codyhosterman/powercli/blob/master/unmapsdk.ps1
Description:
Runs through VMFS volumes in a vCenter that are on a FlashArray volume and runs a space reclamation against it. Logs the results to a file and optionally Log Insight.
See the unattended version of this here:
https://www.codyhosterman.com/2017/04/unattended-flasharray-vmfs-unmap-script/
Automated FlashArray Host Group Creation
Blog Post:
FlashArray Host Group Creation PowerShell Script for VMware Clusters
Script:
https://github.com/codyhosterman/powercli/blob/master/createhostgroups.ps1
Description:
Takes in a vCenter cluster of ESXi hosts and creates corresponding host group and hosts on one or more FlashArrays. Logs the results to a file.
Set Pure Storage FlashArray VMware Best Practices
Blog Post:
Updated FlashArray VMware Best Practices PowerCLI Scripts
Script:
https://github.com/codyhosterman/powercli/blob/master/bestpractices.ps1
Description:
Takes in a vCenter and sets the best practices for VMware ESXi in accordance of Pure Storage requirements. Focuses on things that are not set by default. Logs the results to a file.
Check Pure Storage FlashArray VMware Best Practices
Blog Post:
Updated FlashArray VMware Best Practices PowerCLI Scripts
Script:
https://github.com/codyhosterman/powercli/blob/master/bestpracticechecker.ps1
Description:
Takes in a vCenter and checks the best practices for VMware ESXi in accordance of Pure Storage requirements. This checks for far more things then the “set” script does. Only checks, does NOT make any changes to VMware ESXi. Logs the results to a file.
Identify VMFS Dead Space on the FlashArray
Blog Post:
Detecting what FlashArray VMFS Volumes Have Dead Space
Script:
https://github.com/codyhosterman/powercli/blob/master/IdentifyDeadSpace.ps1
Description:
This script looks at the virtual space of a volume and compares it to the corresponding used space of the VMFS. It returns all datastores that surpass a specified dead space threshold.
Refresh Test/Dev VMFS Copy from FlashArray Snapshot
Blog Post:
None currently.
Script:
https://github.com/codyhosterman/powercli/blob/master/presentVMFScopy.ps1
Description:
Takes in two VMFS datastores and refreshes the second with a FlashArray snapshot of the first. These VMFS volumes can be on the same or different FlashArrays. If they are on different ones, the first volume must have replicated snapshots on the second FlashArray.
Semi-Transparent VM Failover between FlashArrays
Blog Post:
Semi-transparent failover with VMFS and Active/Passive Replication
Script:
https://github.com/codyhosterman/powercli/blob/master/disallowsnapshotlunfailover.ps1
Description:
Leverages FlashArray replication to failover VMs on replicated datastores from one FlashArray to another without having to unregister them.
Identify FlashArray volume name of a VMFS
Blog Post:
None currently.
Script:
https://github.com/codyhosterman/powercli/blob/master/findFlashArrayVolumeNamefromVMFSName.ps1
Description:
Takes in a datastore and provides the FlashArray volume name that hosts it.
Identify force-mounted VMFS volumes
Blog Post:
None currently.
Script:
https://github.com/codyhosterman/powercli/blob/master/findforcemountedVMFS.ps1
Description:
Identifies VMFS volumes that are force-mounted in a vCenter.
FlashArray Protection Group Recovery
Blog Post:
Protection Group Recovery in PowerShell
Script:
https://github.com/codyhosterman/powercli/blob/master/protectiongrouprecovery.ps1
Description:
Perform a FlashArray Protection Group Recovery (Copy) with PowerShell and Invoke-RestMethod.
Custom Event Injection to Log Insight
Blog Post:
Using PowerShell with the VMware Log Insight REST API
Script:
https://github.com/codyhosterman/powercli/blob/master/LogInsightIngestionRESTexample.ps1
Description:
Inject custom events into Log Insight with PowerShell.