vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 90 forks source link

PowerNSX doesn't check if parameter is null or empty #612

Open Nick-Andreev opened 4 years ago

Nick-Andreev commented 4 years ago

PowerNSX doesn't validate if parameter is null or empty. So if I accidentally make a typo in the variable name, like so Get-NsxEdge -Name $publicEsgNmae, PowerNSX will treat empty value as a wildcard and retrieve all ESGs in the environment.

Typically cmdlets (like PowerCLI for example), will throw an error for an empty value:

Get-VDPortgroup : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

As a result of this, command like Get-NsxEdge -Name $publicEsgNmae | Remove-NsxEdge, may attempt to wipe out all ESGs from NSX.

Scary stuff.

alagoutte commented 4 years ago

Yes good known... need to add to each cmdlet...