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
# 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
<# 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 = @() |
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
#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' |
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
#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