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.51 -User administrator@vghetto.local -password VMware1! | Out-Null | |
$vmhosts = Get-VMHost | |
foreach ($vmhost in $vmhosts) { | |
$vmhostName = $vmhost.Name | |
$vmhostServiceTag = "N/A" | |
$otherInfos = $vmhost.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo | |
foreach ($info in $otherInfos) { |
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
##### *Nix using openssl (http://www.virtuallyghetto.com/2012/04/extracting-ssl-thumbprint-from-esxi.html) | |
echo -n | openssl s_client -connect 192.168.1.200:443 2>/dev/null | openssl x509 -noout -fingerprint -sha1 | |
SHA1 Fingerprint=AF:3F:70:E6:78:50:41:76:F0:E0:55:78:C0:77:49:FB:69:36:93:6C | |
##### Windows using PowerShell Option #1 (https://communities.vmware.com/thread/501913?start=0&tstart=0) | |
Function Test-WebServerSSL { | |
# Function original location: http://en-us.sysadmins.lv/Lists/Posts/Post.aspx?List=332991f0-bfed-4143-9eea-f521167d287c&ID=60 |
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
# Author: William Lam | |
# Blog: www.virtuallyghetto.com | |
# Reference: http://www.virtuallyghetto.com/2016/07/how-to-automate-vsphere-mob-operations-using-powershell.html | |
# Example of calling QuerySyncingVsanObjects() (http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.host.VsanInternalSystem.html) w/PowerCLI + vSphere MOB ### | |
Function Get-VsanObjectStatus { | |
param( | |
[Parameter( | |
Position=0, | |
Mandatory=$true, |
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
$esxiserver = "192.168.1.200" | |
$esxiusername = "root" | |
$esxipassword = "vmware123" | |
Connect-VIServer -Server $esxiserver -User $esxiusername -Password $esxipassword -WarningAction SilentlyContinue | |
$vihost = Get-View -Server $esxiserver -ViewType HostSystem -Property Name, Summary | |
Write-host "`nESXi Host: " $vihost.Name | |
Write-Host "vCenter Server: " $vihost.Summary.ManagementServerIp |
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
$esxi_name = "192.168.30.10" | |
$portgroup_name = "vMotion" | |
$hostsystem = (Get-VMHost -Name $esxi_name).ExtensionData | |
$networkSystem = Get-View $hostsystem.ConfigManager.NetworkSystem | |
$nic = New-Object VMware.Vim.HostVirtualNicSpec | |
$ip = New-Object VMware.Vim.HostIpConfig | |
$ip.Dhcp = $false | |
$ip.IpAddress = "192.168.1.10" | |
$ip.SubnetMask = "255.255.255.0" |
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
$guestOpsMgr = (Get-View $global:DefaultVIServer.ExtensionData.Content.guestOperationsManager) | |
$authMgr = (Get-View $guestOpsMgr.AuthManager) | |
$vm = (Get-VM -Name MacOSX-10.11).ExtensionData.MoRef | |
$credential = New-Object VMware.Vim.NamePasswordAuthentication | |
$credential.InteractiveSession = $false | |
$credential.Username = "lamw" | |
$credential.Password = "vmware123" | |
$authMgr.ValidateCredentialsInGuest($vm,$credential) |
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
Function Get-YouTubeStat { | |
param( | |
[Parameter(Mandatory=$true)][String]$VideoId | |
) | |
# Replace APIKey with your Google API key and ensure YouTube API is enabled | |
$stats = irm "https://www.googleapis.com/youtube/v3/videos?id=$VideoId&key=$APIKey&part=statistics" | |
$stats.items.statistics | Select ViewCount,LikeCount | |
} | |
Get-YouTubeStat -VideoId Ek6FArKyMBc |
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
$vsanJsonURL = "https://partnerweb.vmware.com/service/vsan/all.json" | |
$currentJsonFile = "current-vsan-hcl.json" | |
$latestJsonFile = "latest-vsan-hcl.json" | |
if(-Not (Test-Path $currentJsonFile)) { | |
# Never ran before, download current JSON and the next time | |
# the script run, it will have something to compare to | |
$results = Invoke-WebRequest -Uri $vsanJsonURL | |
$results.Content | Out-File -FilePath $currentJsonFile | |
} else { |
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 | |
# VMware vSphere Python SDK | |
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |