Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
vmwarecode / snippet.js
Created October 18, 2016 21:18
Combine and sort two string arrays
//
// VMware vRealize Orchestrator action sample
//
// - Combines two arrays of strings
// - Removes duplicate entries
// - Alphabetically sorts the array
//
//Action Inputs:
// array1 - Array/string
// array2 - Array/string
@vmwarecode
vmwarecode / snippet.txt
Created October 3, 2016 16:07
PowerCLI Script to create a VM in VCD using a Template
########################################################################################################################
#Script to create a Cloud VM from a template
########################################################################################################################
#Setting up the powercli environment
C:\"Program Files (x86)"\VMware\Infrastructure\"vSphere PowerCLI"\Scripts\Initialize-PowerCLIEnvironment.ps1
#Connecting to the CI Server
@vmwarecode
vmwarecode / snippet.ps1
Created October 3, 2016 06:24
Set the VSAN Disk Autoclaim Mode for VSAN Hosts.
#Set the VSAN Host autoclaim mode for VSAN. (This script disables autoclaim)
# Reference: http://www.virtuallyghetto.com/2013/09/additional-steps-required-to-completely.html
$hosts = Get-Cluster VSAN-Cluster | Get-VMHost
foreach($vihost in $hosts)
{$esxcli = get-vmhost $vihost | Get-EsxCli
$esxcli.vsan.storage.automode.set($true) | out-null}
Write-Host "Setting VSAN Disk AutoClaim Mode to 'False'"
sleep 5
Write-Host "Done"
@vmwarecode
vmwarecode / snippet.ps1
Created September 26, 2016 18:51
Move ESX to a Datacenter
Function Move-ESXtoDataCenter {
<#
.SYNOPSIS
Moves a ESX to the location that is specified by the Datacenter parameter
.PARAMETER ESXName
Specifies the ESX you want to move to another location
.PARAMETER DatacenterName
Specifies the datacenter where you want to move the ESX
.EXAMPLE
Move-ESXtoDataCenter -ESXName 10.20.30.40 -DatacenterName 'theDatacenter'
@vmwarecode
vmwarecode / snippet.js
Created August 10, 2016 21:40
Reboot Guest OS on vSphere VM and wait
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
// Reboots a vSphere VM and waits for the guest OS to be
// back on the network
//
// Requires VMtools to be functional in the guest OS.
//
@vmwarecode
vmwarecode / snippet.js
Created August 6, 2016 04:16
Add Port Group to Distributed Virtual Switch with VLAN
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
// Creates a distributed virtual portgroup on a vlan with static binding and auto expand enabled.
//
//Action Inputs:
// dvSwitch - VC:VmwareDistributedVirtualSwitch
// dvPortGroupName - string
@vmwarecode
vmwarecode / snippet.java
Created July 18, 2016 10:31
VRA End-to-End Blueprint Creation
Download EntoEnd.jar from the below link as the file is>10MB to upload here
https://confluence.eng.vmware.com/display/RDO/VRA+6.2.x+Blueprint+End-to-End+jar
@vmwarecode
vmwarecode / snippet.js
Created July 14, 2016 04:14
Showing Web Console of a VM via vSphere HTML Console SDK
<html>
<head lang="en">
<meta charset="UTF-8">
<title>VM Web Console</title>
<!-- common js/css lib -->
<link href="css/wmks-all.css" rel="stylesheet" type="text/css" />
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="lib/jquery-1.8.3.min.js"></script>
<script src="lib/jquery-ui-1.8.16.min.js"></script>
@vmwarecode
vmwarecode / snippet.cpp
Created July 13, 2016 14:02
Sample to demonstrate Mounting of target VMs vmdk on physical or virtual proxy using VDDK SDK.
/*
* vixMntApiSample.cpp --
*
* Sample program to demonstrate mounting of vmdk on proxy using
* vixDiskLib and vixMntApi DLL.
*/
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
@vmwarecode
vmwarecode / snippet.sh
Created July 13, 2016 10:57
Memory Checker for ESXi Resource Groups
#################################################################################
#
# @file : mem-resource-groups.sh
# @author : hsadashiv@vmware.com
#
# This script is used to validate and get the memory related issues from the
# all resource groups
#
#################################################################################