VMware Sample Exchange
Browse and download code samples from VMware as well as code samples contributed by the VMware community. Log in to Sample Exchange using your MyVMware credentials to submit requests for new samples, contribute your own samples, as well as propose a sample as a solution for open requests.
Disclaimer: All sample content and code in Sample Exchange is licensed to you by the sample's author. VMware does not guarantee the samples; they are provided "AS IS". Use of this site is subject to the VMware Community Terms of Use.
Browse the list below for code samples from VMware and the community. You can filter the list of samples by selecting a platform or language, or enter other search keywords above.
Filters
Type
SDK / Platform / Tool
Contributor
Language
- Setup vSAN Stretched Cluster DRS RulesThis script can be run against a vSAN Stretched Cluster to create Host Groups and VM Groups. The script requires PowerCLI 6.5.1, released 4/20/2017 and has been tested against vSAN 6.6. Using PowerCLI ...VMware PowerCLI PowerShell
- vSAN 6.6 Encryption RekeyThis script will initiate a Rekey of a vSAN Cluster. Shallow Rekeying (KEK Only) or Deep Rekeying (DEK Also) are supported, as well as Reduced Redundancy if necessary. This requires PowerCLI 6.5.1 a ...VMware PowerCLI PowerShell
- PowerCLI Port of RVC command vsan.cluster_infoThis script includes a function that reports the vSAN Cluster information for a vSAN Cluster. Information included is: Host configurations vSAN Witness Host configuration (if Stretched Cluster or 2 N ...VMware PowerCLI PowerShell
- PowerCLI Port of RVC command vsan.disks_infoThis PowerCLI script will return a list of local disks on a vSAN host as the vsan.disks_info RVC command does. Disk information includes the name, model, revision, whether an SSD or not, use by vSAN ...VMware PowerCLI PowerShell
- PowerCLI Port of RVC command vsan.stretchedcluster.witness_infoThis script includes a function that reports the vSAN Witness information for a 2 Node or Stretched vSAN Cluster. Information included is: Cluster Name Witness Host Name Witness Uuid Witness IP Addre ...VMware PowerCLI PowerShell
- PowerCLI Port of RVC command vsan.health.cluster_repair_immediatelyThis script will invoke the process to repair any vSAN Objects that need to be repaired. This is typically used when the 60 minute (default) Repair Timer has not expired, but an administrator would li ...VMware PowerCLI PowerShell
- PowerCLI Port of RVC commands vsan.health.cluster_proxy_configure and vsan.health.cluster_proxy_statusThis script contains 2 Functions that can get or set the vSAN Proxy Configuration. These align with the following RVC commands: vsan.health.cluster_proxy_configure vsan.health.cluster_proxy_statusVMware PowerCLI PowerShell
- QueryvsanclusterSample code showing how to to query vCenter for vSAN health information.Other Platform Python
- Sample vSAN Encryption ReportThis script shows a basic enumeration of vSAN Encryption reporting using the Get-VsanView cmdlet. It shows overall health as well as some detailed reporting. Requires PowerCLI 6.5.1 (or higher) an ...VMware PowerCLI PowerShell
- vSAN Cluster MaintenanceIn a cluster without DRS enabled, user should manually migrate the virtual machines off a host to let the host enter Maintenance Mode. This sample script can automate this process and let the hosts en ...VMware PowerCLI PowerShell