Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
vmwarecode / snippet.js
Created November 22, 2015 02:54
Find vSphere VM by Name across all vCenters in vRealize Orchestrator
//action Inputs:
// vmName - string
//
//Return Type: VC:VirtualMachine
var found = VcPlugin.getAllVirtualMachines(null, "xpath:name[matches(.,'"+vmName+"')]");
if (found.length > 1) {
throw(vmName+" matched more than one Virtual Machine");
}
if (found.length == 1) {
@vmwarecode
vmwarecode / snippet.js
Created November 22, 2015 03:00
Get Next SCSI Unit Number for vCenter VM in vRealize Orchestrator
//Action Inputs:
// vm - VC:VirtualMachine
// scsiController - number (Defaults to 0)
//
//Return Type: number
var devices = vm.config.hardware.device;
var controllerKey;
var controllerUnit; // typically '7'
if (scsiController == null) {
@vmwarecode
vmwarecode / snippet.js
Last active April 10, 2022 13:20
Parse multiline CSV string as Array of Properties
/******************************************************
* Parses a CSV string as an array of Properties.
* The first row of the CSV file is assumed to be
* the header row. This row will act as the keys
* for each rows "Properties" object.
*
* Written for VMware vRealize Orchestrator (vRO)
******************************************************/
//Action Inputs:
@vmwarecode
vmwarecode / snippet.txt
Created November 25, 2015 10:56
Docker image to run pyvmomi
FROM ubuntu:trusty
MAINTAINER Lino Telera Linoproject.net <[email protected]>
# Install base packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
python \
python-pip python-dev build-essential \
openssh-server
@vmwarecode
vmwarecode / snippet.ps1
Created November 26, 2015 08:50
Get IPMI Address
# Script from http://poshcode.org/?show=928
function Get-VMHostWSManInstance {
param (
[Parameter(Mandatory=$TRUE,HelpMessage="VMHosts to probe")]
[VMware.VimAutomation.Client20.VMHostImpl[]]
$VMHost,
[Parameter(Mandatory=$TRUE,HelpMessage="Class Name")]
[string]
$class,
@vmwarecode
vmwarecode / snippet.js
Created November 28, 2015 21:54
Get IaaS VirtualMachineID from Cafe ResourceID
//Action Inputs:
// resourceId - string
//
//Return Type: string
var hosts = Server.findAllForType("vCACCAFE:VCACHost");
var cafehost = hosts[0];
var catalogResource = vCACCAFEEntitiesFinder.getCatalogResource(cafehost, resourceId);
return catalogResource.providerBinding.getBindingId();
@vmwarecode
vmwarecode / snippet.txt
Created December 10, 2015 02:45
Script to install ESXi Embedded Host Client
#!/usr/bin/env bash
# @file install_esxi_host_client
# Download and install the ESXi html client and patch
# @see https://labs.vmware.com/flings/esxi-embedded-host-client
# @author Alister Lewis-Bowen <[email protected]>
set -e
is_installed() {
# @see https://gist.github.com/JamieMason/4761049
@vmwarecode
vmwarecode / snippet.txt
Created December 10, 2015 02:46
Script to install ESXi Embedded Host Client
#!/usr/bin/env bash
# @file install_esxi_host_client
# Download and install the ESXi html client and patch
# @see https://labs.vmware.com/flings/esxi-embedded-host-client
# @author Alister Lewis-Bowen <[email protected]>
set -e
is_installed() {
# @see https://gist.github.com/JamieMason/4761049
@vmwarecode
vmwarecode / snippet.ps1
Created December 21, 2015 17:55
Storage vMotion Activities Report
# Author: Dennis Zimmer, company: opvizor GmbH
# HTML structure based on:
# http://www.myexchangeworld.com/2010/03/powershell-disk-space-html-email-report/
# Script based on sVMotion history
# Source: http://www.lucd.info/2013/03/31/get-the-vmotionsvmotion-history/
# Variables
$from = "sender@"
$to = "receiver@"
$subject = "VMware SVMotion Activities - $Date"
@vmwarecode
vmwarecode / snippet.ps1
Created December 22, 2015 06:34
Get status ofr datastores
# Track Datastore Space script #
# #
###################################################
# Variables #
#############
$VIServer = Read-Host "Enter IP or Hostname for your VI Server"
$digits = 2
$Folder = 'C:\Scripts'