Powershell: PowerNSX: Refusing to load module.

"The PowerShell Core Beta has known issues that cause PowerNSX to fail.  Refusing to load module."
Basically, this happens when you upgrade powershell to 6.1.x.  It's related to a bad section of code in the module that checks for beta releases that should probably deprecated or taken out.

Modify line 82 to read as such:
if ( ( $script:PNsxPSTarget -eq "Core" ) -and ( $PSVersionTable.GitCommitId -notmatch '^v6.[\d].[\d]+$|6.[\d].[\d]+$') ) {


Comment out line 82 through 90 to remove the check entirely.

The check appears to happen because the GitCommitId format may have changed from 6.0 to 6.1 where it was prepended with a v in 6.0 whereas in 6.1 it is not longer prepended.


PowerCLI: The SSL connection could not be established, see inner exception.

Unable to connect to ESXi/vCenter server with Connect-VIserver cmdlet, get the following error:
"The SSL connection could not be established, see inner exception."

Be sure to "Set-PowerCLIConfiguration -InvalidCertificateAction:Ignore" if you plan to connect to an ESXi/vCenter that does not have trusted certificate.  Interestingly, something must've changed recently because the PowerCLI module actually would output a more descriptive message about setting your PowerCLIConfiguration.

This appears to be the case w/ Powershell Core 6.1.  I'm actually unsure when this behavior started happening and whether is module or powershell related.  Regardless, figured I'd post this since I was initially confused myself when running some things on another system.

Powershell: Making a RESTful API endpoint in powershell (kinda like python flask)

While running scripts interactively and even on a scheduled basis is fine, I wanted to explore the possibility of making my scripts event-driven.  Take the vCheck Health Script for example.  Running that on a schedule is fine, but what if I wanted to run that on-demand?  Or other scripts in general?

The cool thing, you can do it all in Powershell Core!  Meaning, docker, linux, macOS, etc.  Basically, you can have this script run on OS startup (pre-populated with your endpoint configs/scripts) and you would have a Powershell driven REST-style API endpoint to run your scripts.

Here is the example, feel free to try it.  It'll do nothing of consequence on it's own.  I'll post later with a video on how to use it.

Powershell Core: DNSClient cmdlets .NET Alternative

DNS Cmdlets are not available in Powershell Core, but fear not, you can make use of .NET to get effectively the same functions, for DNS resolution anyway.

My old post here details how to use .NET method:

Useful Powershell .NET method to convert DNS name to IP

VMware: Get CDP/LLDP info from ESXi/vCenter hosts.

Had to get CDP/LLDP long time ago and never posted it.  Hosted on gist.github.com for anyone to consume and manipulate how they please.  Definitely been useful and faster since it'll actually ignore disconnected nics.

Also automatically adjusts for CDP or LLDP.  I 'think' I wrote this, but I borrow so much from Lam and LucD that they deserve credit for being so awesome anyway.