View DeleteNSXTRouteFilter.sh
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
echo -n Enter NSX Manager IP: | |
read nsxmgr | |
echo -n Enter NSX Manager admin password: | |
read -s secret | |
# The below curl command will display logical router id's and display names for those id's. | |
curl -k -u admin:$secret https://$nsxmgr/api/v1/logical-routers/ | awk -F ': ' '/"id"/{print substr($2,2, length($2)-3)} /"display_name"/{print substr($2,2, length($2)-3)}' | |
echo -n Enter target router id: | |
read routerid |
View NewNSXTApplianceCerts.sh
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
# These values are unique to your environment. | |
# DO NOT USE this code if your NSX-T instance is managed by a service provider. | |
# You risk breaking your SLA/contracts/blahblahblah and yourself. | |
NSXMgr=IPorDNSNameofyourNSXManager | |
domainsuffix=zsoldier.com | |
org=zsoldiernet | |
orgunit=blog | |
country=US | |
state=GA | |
locality=ATL |
View Get-NSXTVirtualMachineData.ps1
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
$Credential = Get-Credential | |
$skipcertcheck = $true | |
$AuthMethod = “Basic” | |
$NSXMgr=”NSXTManagerIPorDNSName” | |
$policyapi = "/policy/api/v1" | |
$base_url = ("https://" + $NSXMgr + $policyapi) | |
$endpoint = "/infra/realized-state/virtual-machines" | |
$Data = Invoke-restmethod -Uri ($base_url + $EndPoint) -Method GET -Credential $Credential -SkipCertificateCheck:$skipcertcheck -Authentication:$AuthMethod |
View getnsxt0bgproutes.sh
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
#Have not figured out how to have jq output an array for bash to loop through. | |
nsxt=DNSnameORIPAddressofNSXTManager | |
username=admin | |
password='superduperSecure!' | |
endpoint='policy/api/v1' | |
#Checks to see if you have jq installed. | |
if ! command -v jq &> /dev/null | |
then | |
echo "jq is needed for code for below code to work. Download or use brew/apt/packagemanager to install. https://stedolan.github.io/jq/" | |
exit |
View Get-NSXT0BGPRouteTable.ps1
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
$NSXMgr = Read-Host "Please provide NSX-T DNS name or IP address." | |
$Credential = Get-Credential -Message "Please provide NSX-T username and password." | |
$skipcertcheck = $true | |
$AuthMethod = “Basic” | |
$policyapi = "/policy/api/v1" | |
$base_url = ("https://" + $NSXMgr + $policyapi) | |
$endpoint = "/infra/tier-0s/" |
View run-diskspd.ps1
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
$testtimer=1800 | |
$writepct=50 | |
$blocksize='64k' | |
$threads=4 | |
$outstandingio=16 | |
$warmuptime=5 | |
$filesize="10G" | |
$drives=@('D','E','F','G') | |
#$drives=@('E') | |
$diskspdpath = "C:\Users\Administrator\Downloads\DiskSpd\amd64\diskspd.exe" |
View Clear-NSXTDNSCache.ps1
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
#Clear NSX-T DNS Cache | |
$creds = Get-Credential -Message "Provide NSX-T username and password" | |
$HostnameorIP = Read-Host "Provide IP or hostname for NSX-T Manager" | |
$DNSForwarders = Invoke-restmethod -Uri "https://$HostnameorIP/api/v1/dns/forwarders" -Method Get -Credential $creds -Authentication:Basic -SkipCertificateCheck:$true | |
$DNSForwarders.results | Select id, listenerip, display_name | |
#Copy the id value from the DNS forwarder you would like to clear cache on and place into $id variable below. | |
#$id=$DNSForwarders.results[0].id # < Works against first return. If you have more than one NSX-T DNS Forwarder, you'll need to select different record. | |
$id='id value provided by above' |
View ClearNSXTDNSCache.sh
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
nsxt=iporDNSnameofNSXManager | |
username=admin | |
password='' | |
if ! command -v jq &> /dev/null | |
then | |
echo "jq is needed for code for below code to work. Download or use brew/apt/packagemanager to install. https://stedolan.github.io/jq/" | |
exit | |
fi |
View Request-AzureJIT.ps1
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
#Requires -Module az.accounts, az.security | |
# Change all below mandatory to $true if you'd like to force parameters. | |
# Otherwise, you can fill in variables w/ defaults or your choosing like below. | |
function Request-AZJIT { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$false)] | |
[string] | |
$AzureVMName = "nameofyourAzureVM", | |
[Parameter(Mandatory=$false)] |
NewerOlder