Instantly share code, notes, and snippets.

View Get-SSLCert.ps1
Function Get-SSLCert{
Gets SSL certificate of remote system.
Gets SSL certificate of remote system in order to get it's thumbprint.
Returns the certificate as object.
View PowerShellRestEndPoint.ps1
# Reference:
# Create a listener on port 7000
$listener = New-Object System.Net.HttpListener
'Listening ...'
# Run until you send a GET request to /end
while ($true) {
$context = $listener.GetContext()
View Get-CDPorLLDPInfofromESXi.ps1
function Get-CDPorLLDP {
$myCol = @()
foreach ($VIServer in $global:DefaultVIServers)
$vmhosts = Get-VMHost -Server $VIServer | where-object {$_.ConnectionState -eq "Connected" -or "Maintenance"}
foreach ($vmhost in $vmhosts)
Write-Host "Collating information for $($VMHost.Name)"
$networkSystem = Get-view -Server $viserver -Id $vmhost.extensiondata.ConfigManager.NetworkSystem
foreach($pnic in $networkSystem.NetworkConfig.Pnic)
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 = @()
View get-vmhostwsmaninstance.ps1
function Get-VMHostWSManInstance {
param (
[Parameter(Mandatory=$TRUE,HelpMessage="VMHosts to probe")]
[Parameter(Mandatory=$TRUE,HelpMessage="Class Name")]
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-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
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 #>
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
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(" ", ""))