Skip to content

Instantly share code, notes, and snippets.

View jakerobinson's full-sized avatar
👻

Jake Robinson jakerobinson

👻
View GitHub Profile
@jakerobinson
jakerobinson / gist:5615100
Created May 20, 2013 20:09
vCloud Backups

vCloud vApp and VM Backups

Introduction

vCloudBackups provides a way to hot clone VMs and vApps running in a Virtual Datacenter for the purpose of local backups.

This release should work with any vCloud Provider running 1.5 or 5.1.

Description

@jakerobinson
jakerobinson / Rakefile
Last active December 18, 2015 05:38 — forked from stammy/Rakefile
# Jekyll Rake tasks
desc 'create new post or page. args: type (post, page), title, future (# of days)'
# rake new type=(page|post) future=0 title="New post title goes here" slug="slug-override-title"
task :new do
require 'rubygems'
require 'chronic'
type = ENV["type"] || "post"
title = ENV["title"] || "New Title"
@jakerobinson
jakerobinson / gist:8449990
Created January 16, 2014 04:55
vCheck file encoding
/
Changelog.txt: text/plain; charset=us-ascii
EndScript.ps1: text/plain; charset=utf-8
GlobalVariables.ps1: text/plain; charset=utf-16le
Headers: application/x-directory; charset=binary
Plugins: application/x-directory; charset=binary
README.md: application/octet-stream; charset=binary
Select-Plugins.ps1: text/plain; charset=us-ascii
Styles: application/x-directory; charset=binary
vCheck.ps1: text/plain; charset=utf-16le
<?xml version="1.0" encoding="UTF-8"?><vcloud:EdgeGateway
xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
name="gateway"
operationKey="operationKey">
<vcloud:Description>Edge Gateway description</vcloud:Description>
<vcloud:Configuration>
<vcloud:BackwardCompatibilityMode>false</vcloud:BackwardCompatibilityMode>
<vcloud:GatewayBackingConfig>compact</vcloud:GatewayBackingConfig>
<vcloud:GatewayInterfaces>
<vcloud:GatewayInterface>
@jakerobinson
jakerobinson / vcloud-vm-report.ps1
Last active August 29, 2015 14:05
simple-vm-reporting-in-vcloud-with-powercli
$vms = get-civm
$objects = @()
foreach($vm in $vms)
{
$hardware = $vm.ExtensionData.GetVirtualHardwareSection()
$diskMB = (($hardware.Item | where {$_.resourcetype.value -eq "17"}) | %{$_.hostresource[0].anyattr[0]."#text"} | Measure-Object -Sum).sum
$row = New-Object PSObject -Property @{"vapp" = $vm.vapp; "name"=$vm.Name;"cpuCount"=$vm.CpuCount;"memoryGB"=$vm.MemoryGB;"storageGB"=($diskMB/1024)}
$objects += $row
}
#Get the dvSwitch I want to edit
$dvswitch = Get-VirtualSwitch name dvSwitch -distributed | Get-View
#create the spec, note the object type
$spec = New-Object VMware.Vim.DVSConfigSpec
$spec.configVersion = $dvswitch.Config.ConfigVersion
$spec.defaultPortConfig = New-Object VMware.Vim.VMwareDVSPortSetting
$spec.defaultPortConfig.uplinkTeamingPolicy = New-Object VMware.Vim.VmwareUplinkPortTeamingPolicy
#policy
$datastore = "MyDatastore"
$viserver = "MyVIServer"
# add PowerCLI snapin
Add-PSSnapin vmware.vimautomation.core -ErrorAction:SilentlyContinue
# Connect to VI Server
Connect-VIServer $viserver
# Get the datastore we want to clean up
function Export-VM
{
param
(
[parameter(Mandatory=$true,ValueFromPipeline=$true)] $vm,
[parameter(Mandatory=$true)][String] $destination
)
$ovftoolpaths = ("C:\Program Files (x86)\VMware\VMware OVF Tool\ovftool.exe","C:\Program Files\VMware\VMware OVF Tool\ovftool.exe")
$ovftool = ''
# Example with basic types
---
hash:
  string: some text
  number: 12345
  array_of_bool: [on, off, true, false, yes, no]
  ruby symbol: :symbol
  array:
    - item one
    - item two

Keybase proof

I hereby claim:

  • I am jakerobinson on github.
  • I am jakerobinson (https://keybase.io/jakerobinson) on keybase.
  • I have a public key whose fingerprint is 4F4D F3AF A435 7C1B 6E53 1860 DE6A 40F6 FEBC 1254

To claim this, I am signing this object: