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 December 9, 2016 22:43
Decode vSphere License
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Decodes the 'Product Name' and 'Product Version' from a vSphere license string.
// Also does some basic license key format validation
//
//Action Inputs:
// vCenterConnection - VC:SdkConnection
// licenseKey - 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.js
Last active April 10, 2022 13:21
Email Base64 encoded PDF file from Orchestrator
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Email Base64 encoded PDF file from Orchestrator
//
// This sample takes a base64 encoded PDF from a web service and attaches
// it to an email message with vRealize Orchestrator.
//
// Currently this sample requires enabling local process execution.
@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.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.py
Created July 8, 2016 07:27
VMDIR Constraint Violation and Consistency Checks
#!/usr/bin/python
import sys
import getopt
import ldap
import re
issueFound = False
def Usage(name):
print "Usage: " + name + '''
/*
* ****************************************************************************
* Copyright VMware, Inc. 2010-2016. All Rights Reserved.
* ****************************************************************************
*
* This software is made available for use under the terms of the BSD
* 3-Clause license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@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
#
#################################################################################
@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.
//