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" |
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
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 |
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)] |
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 -Modules vmware.powercli | |
$esxihost = "DNSorIPofESXihost" | |
$vmhost = get-vmhost $esxihost | |
$vmhostcli = $vmhost | get-esxcli -v2 | |
$pcidevices = $vmhostcli.hardware.pci.list.invoke() | |
#$pcidevices | where {$_.vendorname -match "Mellanox"} | |
$HCLData = @() | |
Foreach ($pcidevice in $pcidevices){ |
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
#See storage policies available | |
Get-SpbmStoragePolicy | |
#Define storage policy you want to apply | |
$storagepolicyname = "RAID-1 FTT-1" | |
#Capture Storage policy object. | |
$storagepolicies = Get-SpbmStoragePolicy | |
$targetstoragepolicy = ($storagepolicies | where-object {$_.name -eq $storagepolicyname}) |
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
#Change Segment Profiles | |
$Credential = Get-Credential | |
$skipcertcheck = $true | |
$AuthMethod = “Basic” | |
$NSXMgr=”IPorDNSName” | |
$policyapi = "/policy/api/v1" | |
$base_url = ("https://" + $NSXMgr + $policyapi) | |
#Change these to the name of the various profiles you want to remap all your segments to. | |
$TargetIPDPName = "default-ip-discovery-profile" |
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=”IPorDNSName” | |
$Credential = Get-Credential #Must be Enterprise Admin role. Typically “admin” | |
$skipcertcheck = $true | |
$AuthMethod = “Basic” | |
$TargetRouterName = “LeeroyJenkinsT1” | |
#To get target logical router id | |
$lrdata = Invoke-restmethod -Uri “https://$($NSXMgr)/api/v1/logical-routers” -Method GET -Credential $Credential -SkipCertificateCheck:$skipcertcheck -Authentication:$AuthMethod | |
$routerid = ($lrdata.results | Where-Object {$_.display_name -eq $TargetRouterName}).id |
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
# Grab VM object from HCX (Cannot be from vCenter) | |
$vm = Get-HCXVM -Name "NameofVM" | |
# If you have multiple sources or destination, you would need to augment with parameters such as name, server(hcxserver), and/or id. | |
$sourceSite = Get-HCXSite -Source | |
$targetSite = Get-HCXSite -Destination | |
# Source and target networks assume just one network adapter. | |
# For more than one adapter, you would need to loop through each source adapter and add to $NetworkMapping array. | |
$sourceNetwork = $vm.Network[0] |
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 PowerCLI,PowerNSX | |
$ESG = Get-NsxEdge -Name "BobLoblaw" | |
$ESGFW = $ESG | get-NSXEdgeFirewall | |
$ESGFWRules = Get-NSXEdgeFirewallRule -EdgeFirewall $ESGFW | |
$CustomReport = @() | |
$i = 1 | |
Foreach ($Rule in $ESGFWRules) | |
{ | |
$NewObject = "" | Select-Object RuleNo, RuleID, RuleName, Source, Destination, Description, ServicePorts, Action, appliedTo, datacentername |