TomTretbar
Contributor
Contributor

Get-CIRole/Get-CIUser not working?

Hi,

I have a problem with some scripts, that used to work and now stop functioning. While investigating I found that Get-CIRole and/or Get-CIUser are no longer working as expected, and I do not know why.

I try and get the "organization administrators" of some VDC and inform them by e-Mail about some non-optimum VMs (no VMware tools, wrong NIC ...). This used to work that way:

$ORG=$VDC.Org

$ORGADMINROLE=(Get-CIRole -Name "Organization Administrator")

$ORGADMINs=(Get-CIUser -Org $ORG -Role $ORGADMINROLE | sort | Get-Unique)

But now in any case $ORGADMINs is empty. If I query an administrator directly, I get an error (though documentation says it should work that way):

PowerCLI C:\> Get-CIUser -Org $ORG -Name "myadminname"

Name                           External Locked DeployedVMCount StoredVMCount   Org

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

myadminname                    False    False  1               4               managedhosting

PowerCLI C:\> Get-CIUser -Org $ORG -Name "myadminname" | Get-CIRole

Get-CIRole : 17.09.2018 14:35:27    Get-CIRole        Object reference not set to an instance of an object.

At line:1 char:46

+ Get-CIUser -Org $ORG -Name "myadminname" | Get-CIRole

+                                              ~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-CIRole], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Cloud.Commands.Cmdlets.GetCIRole

We use vCloud Director 8.20. Any help is really appreciated, since I am quite lost.

Regards, Tom.

0 Kudos
1 Reply
etcheverri
Contributor
Contributor

Spoiler
Hi , put in the "Get-CIRole" the "-server <servername or ip>" , this make it work again when i was passing from old windows powercli /powershell to new linux powercli/powershell core
0 Kudos