VMware Cloud Community
VCPJOHN20111014
Enthusiast
Enthusiast

get all linked vcenter and psc info

Hi

I'm looking to gather all my linked vcenters and psc server names, and version info.

I found Williams vami module, but that seems to only work for cloud systems as it's using  Get-CisService -Name 'com.vmware.appliance.system.version'

What is the non-cloud equivalent?

Do i need to login to all my vcenters using connect-viserver -Alllinked  ?

Thanks

John

0 Kudos
30 Replies
LucD
Leadership
Leadership

The Get-CisService cmdlet should also work against a non-cloud VCSA


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

it doesn't work,

Get-CisService : You are not currently connected to any servers. Please connect first using a Connect cmdlet.

0 Kudos
LucD
Leadership
Leadership

Did you do the Connect-CisServer first?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

yes, I can't use Connect-CisServer​as there is no cloud systems.

Connect-CIServer : 5/1/2019 10:50:21 AM Connect-CIServer                No Cloud server was found on https://vcenter:443/api/.

0 Kudos
LucD
Leadership
Leadership

You're using Connect-CIServer instead of Connect-CisServer.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

ok i can't read.. sorry for that, but now i have a new error after using the connect-cisserver.. and using administrator@vsphere.local to login

PS D:\admin\AllVMware\JM scripts\vami>  $systemVersionAPI = Get-CisService -Name 'com.vmware.appliance.system.version'

PS D:\admin\AllVMware\JM scripts\vami>     $results = $systemVersionAPI.get() | select product, type, version, build, install_time

Cannot find an overload for "get" and the argument count: "0".

At line:1 char:5

+     $results = $systemVersionAPI.get() | select product, type, versio ...

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Guessing the command Get-CisService -Name 'com.vmware.appliance.system.version' didn't work

thanks for the help

0 Kudos
LucD
Leadership
Leadership

Can you try like this?

Connect-CisServer -Server vcsa-FQDN -User administrator@vsphere.local -Password VMware1!

$service = Get-CisService -Name com.vmware.appliance.system.version

$service.get()


Disconnect-CisServer -Server vcsa-FQDN -Confirm:$false

Which version of VCSA are you using?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

PS D:\admin\AllVMware\JM scripts\vami> Connect-CisServer -Server "vcname.domain.com"

Name                           User                           Port

----                           ----                           ----

vcname.domain.com       Administrator@VSPHERE.LOCAL    443

PS D:\admin\AllVMware\JM scripts\vami> $service = Get-CisService -Name com.vmware.appliance.system.version

PS D:\admin\AllVMware\JM scripts\vami>

PS D:\admin\AllVMware\JM scripts\vami> $service.get()

Cannot find an overload for "get" and the argument count: "0".

At line:1 char:1

+ $service.get()

+ ~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

PS D:\admin\AllVMware\JM scripts\vami>

The Vcenter is 6.5, Build 9451637

I wasn't able to pass the username and password on the connect line successfully, hopefully that doesn't make a difference

0 Kudos
LucD
Leadership
Leadership

What do you mean by "I wasn't able to pass the username and password on the connect line successfully"?
Do you get an error?

Did you check what is in $global:defaultcisservers?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

the vcenter is listed 3 times in $global:defaultcisservers

1st line is fqdn

2 and 3 is the netbios name

user and port is empty

PS D:\admin\AllVMware\JM scripts\vami> Connect-CisServer -Server "vcenter@domain.com" -User administrator@vsphere.local -Password 123

Connect-CisServer : 5/3/2019 9:40:26 AM Connect-CisServer               com.vmware.vapi.std.errors.unauthenticated {'messages': [com.vmware.vapi.std.localizable_message {'id':

com.vmware.vapi.endpoint.method.authentication.required, 'default_message': Authentication required., 'args': []}], 'data':}.

At line:1 char:1

+ Connect-CisServer -Server "administrator@vsphere.local" -User administra ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-CisServer], CisException

    + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Impl.V1.Service.CisConnectionService.SessionCanNotBeCreated,VMware.VimAutomation.Cis.Core.Commands.Cmdlets.ConnectCisS

   erver

I'm able to login still  from the popup window, just doesn't let me put the username and password on the same line.

Does/should this work? and something is wrong with my config or the way i'm doing something wrong?

0 Kudos
LucD
Leadership
Leadership

Can you stop/start your PS/PowerCLI session and start again?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

I closed powercli and started it again.  same issue.

PS C:\> connect-cisserver -server vcenter.domain.com -user administrator@vsphere.local -password 123

connect-cisserver : 5/7/2019 12:16:13 PM        Connect-CisServer               com.vmware.vapi.std.errors.unauthenticated {'messages': [com.vmware.vapi.std.localizable_message {'i

d':

com.vmware.vapi.endpoint.method.authentication.required, 'default_message': Authentication required., 'args': []}], 'data':}.

At line:1 char:1

+ connect-cisserver -server vcenter.domain.com -user administrato ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-CisServer], CisException

    + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Impl.V1.Service.CisConnectionService.SessionCanNotBeCreated,VMware.VimAutomation.Cis.Core.Commands.Cmdlets.ConnectCisS

   erver

PS C:\> connect-cisserver -server vcenter.domain.com

Name                           User                           Port

----                           ----                           ----

vcenter.domain.com       Administrator@VSPHERE.LOCAL    443

PS C:\> $service = Get-CisService -Name com.vmware.appliance.system.version

PS C:\>

PS C:\> $service.get()

A server error occurred: 'com.vmware.vapi.std.errors.unauthenticated': Unable to authenticate user (Server error id: 'vapi.security.authentication.invalid'). Check

$Error[0].Exception.ServerError for more details.

At line:1 char:1

+ $service.get()

+ ~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], CisServerException

    + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException

PS C:\>

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

more info:

PS C:\> Get-PSVersion

Major  Minor  Build  Revision

-----  -----  -----  --------

5      1      14409  1018

PS C:\> Get-PowerCLIVersion

WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.

PowerCLI Version

----------------

   VMware PowerCLI 10.1.0 build 8346946

---------------

Component Versions

---------------

   VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811

   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 8344055

   VMWare ImageBuilder PowerCLI Component 6.7 build 8250345

   VMWare AutoDeploy PowerCLI Component 6.7 build 8250345

   VMware VimAutomation Vds Commands PowerCLI Component PowerCLI Component 10.1 build 8344219

   VMware VimAutomation Cloud PowerCLI Component PowerCLI Component 10.0 build 7893901

   VMware High Availability PowerCLI Component 6.0 build 000000

   VMware HorizonView PowerCLI Component 7.1.0 build 8827468

   VMware VimAutomation License PowerCLI Component PowerCLI Component 10.0 build 7893904

   VMware VimAutomation PCloud PowerCLI Component PowerCLI Component 10.0 build 7893924

   VMware VimAutomation Storage PowerCLI Component PowerCLI Component 10.1 build 8313015

   VMware VimAutomation vROps PowerCLI Component PowerCLI Component 10.0 build 7893921

   VMware vSphere Update Manager PowerCLI 6.5 build 7862888

PS C:\>

0 Kudos
LucD
Leadership
Leadership

Your connection does not work.
Are you sure you are using the correct credentials?
Can you connect with those credentials to the VAMI?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LucD
Leadership
Leadership

You could try to upgrade your PowerCLI version to the latest version (11.2 at this point in time).
Not sure if that will make a difference


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

pastedImage_2.png

got past the login issue, but still getting the error on the get..

0 Kudos
LucD
Leadership
Leadership

Can you do a $service | Get-Member?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VCPJOHN20111014
Enthusiast
Enthusiast

PS C:\> $service | Get-Member

   TypeName: VMware.VimAutomation.Cis.Core.Impl.V1.CisServiceBase

Name        MemberType   Definition

----        ----------   ----------

get         CodeMethod   com.vmware.appliance.system.version.version_struct get()

Equals      Method       bool Equals(System.Object obj)

GetHashCode Method       int GetHashCode()

GetType     Method       type GetType()

ToString    Method       string ToString()

Constants   NoteProperty System.Management.Automation.PSCustomObject Constants=

Help        NoteProperty System.Management.Automation.PSCustomObject Help=@{Documentation={@name Version} {@term service} provides {@term operations} Get the appliance version....

Name        Property     string Name {get;}

Uid         Property     string Uid {get;}

PS C:\>

0 Kudos
LucD
Leadership
Leadership

That all looks perfectly normal.
What does it show when you just display the content of $service?

I just tried the same (again), and for me, it works like expected.

The only difference, I'm on vCenter 6.7

Connect-CisServer -Server vcsa.domain -User administrator@vsphere.local -Password VMware1!

$service = Get-CisService -Name 'com.vmware.appliance.system.version'

$service.get()

Disconnect-CisServer -Server vcsa.domain -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos