vmware / PowerCLI-Example-Scripts

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

Update SaltStackConfig.psm1 #526

Closed bwuch closed 2 years ago

bwuch commented 2 years ago

In the previous version of Connect-SscServer, we assumed that the SaltStack Config master node has an SSL certificate from an authority trusted by the powershell client and that the client supports the same TLS version as the server. However, this may not be the case. Therefore this commit adds support for a switch parameter named SkipCertificateCheck which ignores untrusted certificates and sets support for various TLS versions. All SSC servers I've tested with have only supported Tls12, but lower levels were added to this function for backwards compatibility.

Signed-off-by: Brian Wuchner brian.wuchner@gmail.com

yanlu2 commented 2 years ago

yes, it's fix this issue. and I have another question, not sure if it's something wrong on my machine. when I run my script. 1st I run the script is ok and 2nd it's gave me error. I have to close PS ISE.

Here is ther error, S C:\Users\luy13> C:\PS_scripts\vCenter\vCenter-Export-User-Role2.ps1

Export users/roles in Organization in Pontus rsaengbdvc4.rsa.lab.emc.com

Name Port User


server.com 443 VSPHERE.LOCAL\Administrator

Name : server.com ServiceUri : https://server.com/sso-adminserver/sdk/vsphere.local User : administrator@vsphere.local Id : /SsoAdminServer=vsphere.local/administrator@rsaengbdvc4.rsa.lab.emc.com IsConnected : True Client : VMware.vSphere.SsoAdminClient.SsoAdminClient RefCount : 1

FormatError : The term 'FormatError' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\PS_scripts\vCenter\Group.ps1:218 char:26

bwuch commented 2 years ago

yes, it's fix this issue. and I have another question, not sure if it's something wrong on my machine. when I run my script. 1st I run the script is ok and 2nd it's gave me error. I have to close PS ISE.

Here is ther error, S C:\Users\luy13> C:\PS_scripts\vCenter\vCenter-Export-User-Role2.ps1

Export users/roles in Organization in Pontus rsaengbdvc4.rsa.lab.emc.com

Name Port User

server.com 443 VSPHERE.LOCAL\Administrator

Name : server.com ServiceUri : https://server.com/sso-adminserver/sdk/vsphere.local User : administrator@vsphere.local Id : /SsoAdminServer=vsphere.local/administrator@rsaengbdvc4.rsa.lab.emc.com IsConnected : True Client : VMware.vSphere.SsoAdminClient.SsoAdminClient RefCount : 1

FormatError : The term 'FormatError' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\PS_scripts\vCenter\Group.ps1:218 char:26

  •       Write-Error (FormatError $_.Exception)
  •                    ~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (FormatError:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Hello @yanlu2, I think you may want to submit this question as a separate issue, as it does not appear to be related to the SaltStack Config module.
It may help to include part of the vCenter-Export-User-Role2.ps1 script for reference, but believe you are consuming VMware.vSphere.SsoAdmin module, based on the Group.ps1 script being included as part of the error message. FormatError is the name of a function in the VMware.vSphere.SsoAdmin.psm1 file -- are you sure this module is available in one of the $env:PSModulePath locations on your system?

bwuch commented 2 years ago

Thanks @kamennikolov , I didn't know that would automatically give me input validation, thanks so much for the tip. I've just updated that in the latest commit.