This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use VMware::VIRuntime; | |
use VMware::VILib; | |
Opts::parse(); | |
Opts::validate(); | |
Util::connect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# William Lam | |
# www.virtuallyghetto.com | |
""" | |
vSphere Python SDK program demonstrating starting up ESXi Service | |
""" | |
from optparse import OptionParser, make_option | |
from pyVim.connect import SmartConnect, Disconnect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p /mnt/vmw-tools && mount /dev/cdrom /mnt/vmw-tools && VMW_TOOLS=$(ls /mnt/vmw-tools/ | grep .gz) && cp -f /mnt/vmw-tools/${VMW_TOOLS} /tmp/ && umount /mnt/vmw-tools && rmdir /mnt/vmw-tools && tar -zxvf /tmp/${VMW_TOOLS} -C /tmp/ && cd /tmp/vmware-tools-distrib/ && ./vmware-install.pl -d default && rm -rf vmware-tools-distrib/ && rm -f /tmp/${VMW_TOOLS} && cd ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$json = @" | |
{"A": {"property1": "value1", "property2": "value2"}, "B": {"property1": "value3", "property2": "value4"}} | |
"@ | |
$parsed = $json | ConvertFrom-Json | |
foreach ($line in $parsed | Get-Member) { | |
echo $parsed.$($line.Name).property1 | |
echo $parsed.$($line.Name).property2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opts :add_host2 do | |
summary "Add a host to a cluster" | |
arg :cluster, nil, :lookup => VIM::ClusterComputeResource | |
arg :hostnames, nil, :multi => true | |
opt :username, "Username", :short => 'u', :default => 'root' | |
opt :password, "Password", :short => 'p', :default => '' | |
opt :force, "Force, e.g when host is already managed by other VC" | |
end | |
def add_host2 cluster, hostnames, opts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# William Lam | |
# www.virtuallyghetto.com | |
import json | |
import urllib2 | |
# download json | |
response = urllib2.urlopen('http://partnerweb.vmware.com/service/vsan/all.json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# William Lam | |
# www.virtuallyghetto.com | |
# Lists of all VSAN Storage Controller sorted from smallest to largest Queue Depth | |
import json | |
import urllib2 | |
# download json | |
response = urllib2.urlopen('http://partnerweb.vmware.com/service/vsan/all.json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-VIServer -Server 192.168.1.60 -User administrator@vghetto.local -Password VMware1! | |
$cluster = "MacMini-Cluster" | |
$vmhosts = Get-Cluster $cluster | Get-VMHost | |
foreach ($vmhost in $vmhosts) { | |
# Retrieve VSAN.ClomRepairDelay | |
Get-AdvancedSetting -Entity $vmhost -Name VSAN.ClomRepairDelay | Select Name, Value | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create temp workign directory | |
mkdir -p /mnt/vmw-tools | |
# Mount VMware Tools ISO | |
mount /dev/cdrom /mnt/vmw-tools | |
# Retrieve the VMware Tools package name from the directory | |
VMW_TOOLS=$(ls /mnt/vmw-tools/ | grep .gz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1 = VMware Tools ISO is mounted from vSphere | |
# 2 = Download VMware Tools (assumes you can connect to internet) | |
INSTALL_METHOD=2 | |
# Thanks to Rich Trouton for tip on Tools being available online | |
VMWARE_TOOLS_DOWNLOAD_URL=http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/7.1.2/2779224/packages/com.vmware.fusion.tools.darwin.zip.tar | |
# DO NOT MODIFY BEYOND HERE # |
OlderNewer