Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
vmwarecode / snippet.package
Created December 24, 2015 14:39
How to create Dynamically Populated Drop Downs in Orchestrtator
Action:
 
 
 
input: Location - string
 
return: array/string
 
 
 
@vmwarecode
vmwarecode / snippet.js
Last active October 5, 2016 13:52
Connect all NICs on vSphere VM
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Checks the 'Connected' and 'Connect at power on' setting for every Network Adapter on a VM.
// If the value is false, the workflow will update the setting to true on the Network Adapter.
// VM can be powered off or powered on. All changes applied with a single vm reconfig task
//
//Action Inputs:
// vm - VC:VirtualMachine
@vmwarecode
vmwarecode / snippet.ps1
Created January 11, 2016 14:24
Get ESXi Host ip from VM perspective
Get-VM | Select Name, id, @{Name="IP"; Expression={$_.VMHost | Get-VMHostNetwork | Select -ExpandProperty VirtualNic | where {$_.PortGroupName -match "dvpgManagement"} | Select IP}}
@vmwarecode
vmwarecode / snippet.ps1
Created January 16, 2016 05:25
Move-Migrate VMs to folder Path on another vCenter - Powercli
function Move-VMtoFolderPath {
<#
.SYNOPSIS
Move VM to folder path
.DESCRIPTION
The function retrives complete folder Path from vcenter (Inventory >> Vms and Templates)
.NOTES
Author: Kunal Udapi
http://kunaludapi.blogspot.com
.PARAMETER N/a
@vmwarecode
vmwarecode / snippet.ps1
Created January 21, 2016 13:46
Importing VM annotation and notes from CSV file into vCenter
function Import-VMAnnotation {
<#
.SYNOPSIS
Import VM information Annotation, Notes into VM Attributes
.DESCRIPTION
The function set Annotation, Notes on VM into vcenter, you will require Export-VMAnnotation function to export data into CSV file.
.NOTES
Author: Kunal Udapi
http://kunaludapi.blogspot.com
.PARAMETER N/a
@vmwarecode
vmwarecode / snippet.js
Created January 24, 2016 01:42
Get Distributed Portgroups for a VLAN on a Cluster
//Action Inputs:
// cluster : VC:ClusterComputeResource
// vlan : Number
//
//Action Result: Array/VC:DistributedVirtualPortgroup
var toReturn = new Array();
var networks = cluster.network;
@vmwarecode
vmwarecode / snippet.js
Created January 24, 2016 02:00
Get Database Names from a SQL Server
//Action Inputs:
// hostname : string
// instance : string
// domain : string
// user : string
// password : SecureString
//Action Result: Array/string
@vmwarecode
vmwarecode / snippet.js
Created February 9, 2016 22:11
RabbitMQ Management API - Create Queue
//action inputs
// restHost : REST:RESTHost
// vhost : string
// name : string
// durable : boolean
// autoDelete : boolean
// autoExpire : number
// maxLength : number
// deadLetterExchange : string
// deadLetterRoutingKey : string
@vmwarecode
vmwarecode / snippet.ps1
Created February 10, 2016 16:59
Get VM ip and hostname
$vm = Get-VM
$vmview = $vm | Get-View
Foreach ($v in $vmview){
echo "-----------------------"
echo $v.Name
echo $v.Config.uuid
echo "-----------------------"
$Name = $v.Guest.HostName
If ($Name -ne $null -and $Name -ne ""){
@vmwarecode
vmwarecode / snippet.js
Created February 29, 2016 05:06
Get Online Host from vSphere Cluster
//Action Inputs
// cluster - VC:ClusterComputeResource
//
//Action Result: VC:HostSystem
var hosts = cluster.host;
var host;
for (var h in hosts) {
if (hosts[h].runtime.connectionState.value == "connected" && hosts[h].runtime.inMaintenanceMode == false) {
host = hosts[h];