vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
754 stars 603 forks source link

Enhance Disconnect-SsoAdminServer to support asterisk #387

Closed lamw closed 3 years ago

lamw commented 3 years ago

Just tried out the new PowerCLI SSO Module and when disconnecting from the server, it doesn't behave like other PowerCLI disconnect- commands where you can pass in (asterisk).

In fact, I didn't save the connection, so I had to look up the global variable and even using $Global:DefaultSsoAdminServers didn't work as it expected a specific entry.

Ultimately, I needed to use:

Disconnect-SsoAdminServer -Server $Global:DefaultSsoAdminServers[0]

Ideally, we can simply do:

Disconnect-SsoAdminServer * -Confirm:$false

or even have $Global:DefaultSsoAdminServer also defined like we do for Connect-VIServer cmdlet

qlikq commented 3 years ago

I have raised a PR for this , for similar thing. I have enabled automatic disconnect in case one is connected to a single SSO server. If the is needed, to handle more i can add it as well. #388 --Edit I can't make // or i don't know how, to make the -Server accept the '' because of its type(its not a string). Either one would have to remove the type and leave it as string or add the -Force/-All parameter and if it would appear then it would disconnect from all. If the -Force parameter would be used then it would have the same behavior as the , but still not entirely that classic feel. What about making a 'cheat' and use additional positional parameter: [Parameter(Position = 0)][String][ValidateSet('')]$Srv in that case there will be just the after the cmdlet and we could write a case for it , usage : Disconnect-SsoAdminServer as this this start would be then the 0 position $srv param that only can be a . Thing is that this is bit of 'ugly' and messing with the -server , since one would introduce another mystery 'srv' parameter. We could add another parameterset for this, so it could be more clear so if a * is present then user can't use another parameters as it would violate the parameterset.

dmilov commented 3 years ago

This request is for the so called OBN PowerCLI feature. Will do it for Server parameter.