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 $vcenter -Credential $creds | |
$view = get-view extensionmanager | |
$hcxextensions = $view.extensionlist | where {$_.key -match "com.vmware.hybridity"} | |
foreach ($ext in $hcxextensions){ | |
$view.UnregisterExtension($ext.key) | |
} |
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
#!/bin/sh | |
################################################################################### | |
## Create a pwpolicy XML file based upon variables and options included below. | |
## Policy is applied and then file gets deleted. | |
## Use "sudo pwpolicy -u <user> -getaccountpolicies" | |
## to see it, and "sudo pwpolicy -u <user> -clearaccountpolicies" to clear it. | |
## | |
## Tested on: OS X 10.10 10.11 10.12 | |
#################################################################################### |
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
#Creates a simple cluster object in vCenter Inventory with quickstart disabled. | |
$spec = New-Object VMware.Vim.ClusterConfigSpecEx | |
$spec.InHciWorkflow = $false #Disables QuickStart | |
$_this = Get-View -Id 'Folder-group-h5' | |
$_this.CreateClusterEx($name, $spec) | |
#Disables QuickStart on an existing cluster | |
$Cluster = Get-Cluster "SomeCrazyName" | |
$Cluster.ExtensionData.AbandonHciWorkflow() |
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 "Enter NSX Manager IP or DNS name:" | |
$Creds = Get-Credential -Message "Enter NSX username and password" | |
$PortData = @() | |
$Segments = Invoke-RestMethod -Authentication Basic -Credential $creds -Method Get -Uri "https://$NSXMgr/policy/api/v1/infra/segments/" -SkipCertificateCheck:$true | |
Foreach ($Segment in $Segments.results){ | |
$Ports = Invoke-RestMethod -Authentication Basic -Credential $creds -Method Get -Uri "https://$NSXMgr/policy/api/v1/infra/segments/$($Segment.id)/ports/" -SkipCertificateCheck:$true | |
$PortData += $Ports.results | |
While (!([string]::IsNullOrEmpty($Ports.cursor))){ |
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 |
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. | |
# This script works when running from a MacOS zsh Terminal Session. YMMV w/ Linux Terminals | |
NSXMgr=IPorDNSNameofyourNSXManager | |
domainsuffix=zsoldier.com | |
org=zsoldiernet | |
orgunit=blog | |
country=US | |
state=GA |
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 |
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 |
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/" |
NewerOlder