Skip to content

Instantly share code, notes, and snippets.

/*
* ****************************************************************************
* 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.ps1
Created July 1, 2016 06:15
Deploy Stateless in VCVA
############################################################################
# VMware CopyRight
# Baoyin created in 2010-12-09
# This script used to Create the Depot for stateless ESXi.
#############################################################################
Add-PSSnapin Vmware* -ErrorAction SilentlyContinue
# Connect to the vCenter server
Connect-Viserver -Server VCServerIP -user root -password password -WarningAction SilentlyContinue|out-null
@vmwarecode
vmwarecode / snippet.sh
Created July 1, 2016 06:22
SetupVM and install
#! /bin/bash
#
# Global Variables with default values.
#
UTILS_PATH="$(dirname "$(readlink -f "$0")")"
DS="datastore1"
VMDK_SIZE="50GB"
REMOTE_PORT="5000"
@vmwarecode
vmwarecode / snippet.ps1
Created July 1, 2016 06:43
PowerCli Script to monitor number of snapshots for VMs in a vCenter Server
# The MIT License (MIT)
# Copyright (c) 2015 www.vThinkBeyondVM.com
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON
@vmwarecode
vmwarecode / snippet.ps1
Created July 1, 2016 20:03
Configuring 3D settings of VM
#Author : Jyothsna Terli
#Product : vSphere/VM Video Card 3D settings.
function Set-VMVideoCard3D {
<# .Synopsis This changes the 3d and swRendering settings of the VM to enable and disable the 3D support.
#>
[CmdletBinding()]
Param (
@vmwarecode
vmwarecode / snippet.ps1
Created July 4, 2016 00:40
Update tools in bulk
Add-PSSnapin Vmware* -ErrorAction SilentlyContinue
Set-PowerCLIConfiguration -ProxyPolicy NoProxy -Confirm:$false
echo "Connect to ESX Server..."
Connect-VIServer -Server "10.1.2.3" -User "root" -Password 'pwd'
Get-VM | where { $_.PowerState -eq “PoweredOn” -and $_.Guest.IPAddress -ne $null -and $_.Guest.ToolsVersion -ne $null -and $_.Guest.ToolsVersion -ne ""} | update-tools -RunAsync:$false
Disconnect-VIServer -Server * -Force -Confirm:$false
@vmwarecode
vmwarecode / snippet.py
Created July 4, 2016 00:59
Bulk upgrade VMTools
#!/usr/bin/python -u
import sys
import time
from pyVim.connect import GetSi, SmartConnect, Disconnect
from pyVim.task import WaitForTasks, WaitForTask
from pyVmomi import Vim
from vmware import vsi
from threading import Thread
@vmwarecode
vmwarecode / snippet.txt
Created July 4, 2016 01:37
Predict is upgrade tools would cause reboot
Set Args = wscript.Arguments
If Args.Count() < 2 Then
wscript.echo "Usage: RebootPredict_mainfest.vbs <Abs path to installed manifest> <Abs path to new manifest>"
Wscript.Quit 1
End If
'Compare two values in format of x.x.x.x#x
'True if pre < pro
@vmwarecode
vmwarecode / snippet.java
Last active July 17, 2018 06:56
Deploy virtual machines of ova by ovftool
package com.vmware.g11n;
/**
* Used to deploy a virtual machine of ova by ovftool.
*
* Created by dni@vmware.com on 5/8/15
*/
import java.io.BufferedReader;
import java.io.IOException;
@vmwarecode
vmwarecode / snippet.sh
Last active July 7, 2016 03:23
Extract schema and data from racetrack to your local mysql
#/**
# Used to extract schema and data from racetrack to your local mysql.
#
#Created by dni@vmware.com on 4/3/16/3/16
#/
# connection of Racetrack
racetrack_database_server_name==<racetrack server name>
racetrack_database_name==<racetrack database name>