Skip to content

Instantly share code, notes, and snippets.

Chris Nakagaki Zsoldier

Block or report user

Report or block Zsoldier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am zsoldier on github.
  • I am zsoldier ( on keybase.
  • I have a public key whose fingerprint is 3494 BE50 A321 0EB2 58F5 B635 6789 920B FAC4 6526

To claim this, I am signing this object:

Zsoldier / Configure_AllFlashvSANCluster.ps1
Last active Mar 31, 2016
Script to configure an all flash vsan cluster from scratch.
View Configure_AllFlashvSANCluster.ps1
#Enable All Flash vSAN Intelligently
Import-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue
$TargetHosts = Get-VMHost
#$ESXCLI = $TargetHosts | Get-EsxCli
#$Storage = $Targethosts | Get-SCSILUN
#$Storage.ScsiLun #List of Vendors and model
$CacheDiskVendor = "SanDisk"
$CacheDiskModel = "LT0400WM"
$CapacityDiskVendor = "SanDisk"
$CapacityDiskModel = "LT0800MO"
Zsoldier / Reregister_VMTemplates.ps1
Last active Apr 22, 2016
This is a script you can use to re-register multiple templates to your vCenter's inventory. It will simply get a list of templates, their folder location, host, etc, remove it from inventory and re-add it back exactly where it was.
View Reregister_VMTemplates.ps1
Re-register templates that are locked
KB Reference:
Import-Module vmware.vimautomation.core
Connect-VIServer NameofyourVcenter
$TargetTemplates = Get-Template "NamePatternOfTemplateOrRemoveThisIfYouWantToTargetAllTemplates*" -server $Global:DefaultVIServer
Foreach ($Template in $TargetTemplates)
Zsoldier /
Created Jun 29, 2016
Simple Python script that returns city name from provided longitude and latitude variables from bash. Uses geopy module and appears to work both on Python 2 and 3. City return may or may not be accurate. Kind of guessing by selecting 3rd return record from google and selecting first entry in comma separated return. Needs work obviously.
import sys
def cityinfo(lat, lon):
from geopy.geocoders import GoogleV3
locator = GoogleV3()
address = locator.reverse([lat, lon])
city = address[3].address.split(",")[0]
print(city.replace(" ", ""))
Zsoldier /
Created Jun 29, 2016
Bash script that can be used in GeekTool to generate geekweather2 geeklet image that is placed in /tmp/ directory. This particular version utilizes a python script to return city friendly name since.
LAT="$(~/Dropbox/LocateMe/LocateMe -f "{LAT}")"
LON="$(~/Dropbox/LocateMe/LocateMe -f "{LON}")"
city=$(python ~/Dropbox/GeekTool/ $LAT $LON)
~/Dropbox/GeekTool/ -A $LAT -O $LON -n $city -u UK
Zsoldier / Migrateto-VDSwitch.ps1
Created Sep 18, 2017
Moving connected physical nics and vmk's on ESXi host to DVS/VDS.
View Migrateto-VDSwitch.ps1
You can target a single host or set of hosts. Made to only move 'management' vmk's.
Idea is that you would create vmotion, vsan, etc. vmk's after on VDS/DVS
$VMhost = Get-VMHost "NameofHost"
If you haven't created a vDSwitch yet, you can do so by replacing get-vdswitch with New-VDSwitch
$TargetVDS = New-VDSwitch -Name -Location (get-datacenter "nameofvirtualdatacenter")
$TargetPG = New-VDPortgroup -vdswitch $TargetVDS -Name "Whatevernameyouwant" -VLANID <# Replace if applicable #>
Zsoldier / Get-vCenterScheduledTasks.ps1
Created Sep 20, 2017
Example showing how to get/set scheduled tasks in vCenter/vSphere using PowerCLI
View Get-vCenterScheduledTasks.ps1
function Get-vCenterScheduledTask{
Retrieve vCenter Scheduled Tasks.
Retrieve vCenter Scheduled Tasks.
Source: Automating vSphere Administration
Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,
Alan Renouf, Glenn Sizemore
Zsoldier / Delete-vSANDiskgroup.ps1
Last active Oct 19, 2017
Delete a vSAN Disk Group Forcefully
View Delete-vSANDiskgroup.ps1
Author: K. Chris Nakagaki
Use at your own risk, simply listed here for demonstration purposes to use how you see fit.
<# Get the host w/ problem disk group #>
$VMhost = Get-VMHost NameofHostwithProblemDiskGroup
<# ESXCLI Connection #>
View get-vmhostwsmaninstance.ps1
function Get-VMHostWSManInstance {
param (
[Parameter(Mandatory=$TRUE,HelpMessage="VMHosts to probe")]
[Parameter(Mandatory=$TRUE,HelpMessage="Class Name")]
View Get-NSXFirewallReport.ps1
<# Uncomment if you'd like to use. These are assumed and needed for custom report to work. Must be connected to vCenter and NSXMgr.
Import-Module vmware.powercli,powernsx
$Creds = Get-Credential -Message "Provide vCenter Admin credentials"
$vCenterNameorIP = Read-Host "Provide name or IP of vCenter"
Connect-VIServer $vCenterNameorIP -Credential $Creds
Connect-NSXServer -vCenterServer $vCenterNameorIP -Credential $Creds
$DFWRules = Get-NSXFirewallRule
$CustomReport = @()
You can’t perform that action at this time.