Skip to content

Instantly share code, notes, and snippets.

Avatar

Tony Sangha tonysangha

View GitHub Profile
@tonysangha
tonysangha / vRNI_search_queries.markdown
Last active Sep 16, 2020
vRealize Network Insight Search Queries
View vRNI_search_queries.markdown

Show a list of issues that vRNI has detected. Useful to perform before a migration

topn

Show traffic to the Internet and Order it by bytes

flows where Flow Type = 'Internet'
@tonysangha
tonysangha / bubble_network_2.0.ps1
Created Nov 13, 2017
Updated script by Shane White
View bubble_network_2.0.ps1
<#
Created by Tony Sangha
July 2017
tonysangha.com
version 0.1
Modified by Shane White
October 2017
Version 1.0
@tonysangha
tonysangha / bubble_network.ps1
Last active Aug 4, 2017
PowerNSX script to create a bubble network, consisting of Logical Switches, DLR, ESG and Firewall Rules
View bubble_network.ps1
<#
Created by Tony Sangha
July 2017
tonysangha.com
version 0.1
####################################
macOS PowerCLI specific commands
Get-Module -ListAvailable PowerCLI* | Import-Module
@tonysangha
tonysangha / PowerNSX_OneLiners.ps1
Last active Sep 29, 2017
One liners commands for PowerNSX
View PowerNSX_OneLiners.ps1
# Retrieve any rules that are configured with either block (deny) or reject in the NSX Distributed Firewall
Get-NsxFirewallSection | Get-NsxFirewallRule | ? {$_.action -eq "deny" -or $_.action -eq "reject"} | ft -autosize
# Retrieve services matching port number
get-nsxservice | ? {$_.element.value -eq "80"} | select name
# Compare NSX Services from two different NSX environments and list the differences based on name
# Not really a one liner I know
$old_services = Get-NsxService -Connection $old_env
$new_services = Get-NsxService -Connection $new_env
@tonysangha
tonysangha / powercli#1.ps1
Created Mar 6, 2017
Get Hosts and VMs that belong to certain vSphere clusters using PowerCLI - (OR) Statement
View powercli#1.ps1
$clusters = get-cluster
$clusters | Where-Object {$_.name -like "XXXXX" -OR $_.name -like "XXXXX"} | get-vmhost | select name, Manufacturer, Model, ProcessorType, NumCpu, Version, Build, Parent
$clusters | Where-Object {$_.name -like "XXXXX" -OR $_.name -like "XXXXX"} | get-vm
@tonysangha
tonysangha / get_mac_ipv.ps1
Last active Dec 12, 2016
Get MAC & IP using PowerCLI
View get_mac_ipv.ps1
$vms = get-vm
# Get VM Name based on a MAC
foreach ($vm in $vms){
if(get-networkadapter $vm | where-object {$_.MacAddress -eq "MAC-ADDRESS"})
{
write-host $vm
}
}
@tonysangha
tonysangha / NSX Controller Syslog Update.sh
Last active Nov 6, 2016
Update NSX-v Controller Syslog using a curl command from a bash shell
View NSX Controller Syslog Update.sh
nsx_mgr = 192.168.110.10
user = admin
pass = VMware1!
for x in 1 2 3; do curl -u $user:$pass -H "Content-Type: application/xml" -X GET -k https://$nsx_mgr/api/2.0/vdn/controller/controller-$x/syslog ;done
@tonysangha
tonysangha / NSXv-TOC.md
Last active Feb 21, 2018
Below is a list of links to NSX-v resources I have found useful, it is by no means complete and is a living list that I will update regularly
View NSXv-TOC.md
You can’t perform that action at this time.