Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 223143

Re: The bug in New-VIPermission and how to deal with it.

$
0
0

BTW i got same err

 

 

PowerCLI C:\> function New-VIAccount($principal) {

>>     $flags = `

>>         [System.Reflection.BindingFlags]::NonPublic    -bor

>>         [System.Reflection.BindingFlags]::Public       -bor

>>         [System.Reflection.BindingFlags]::DeclaredOnly -bor

>>         [System.Reflection.BindingFlags]::Instance

>>

>>       $global:defaultviserver.GetType().GetMethods($flags) |

>>     where { $_.Name -eq "VMware.VimAutomation.Types.VIObjectCore.get_Client" }

>>

>>     $client = $method.Invoke($global:DefaultVIServer, $null)

>>     Write-Output (New-Object  VMware.VimAutomation.Client20.PermissionManagement.VCUserAccountImpl  -ArgumentList $principal, "", $client)

>> }

>>

PowerCLI C:\> $account = New-VIAccount "xxx\xxx"

You cannot call a method on a null-valued expression.

At line:9 char:29

+     $client = $method.Invoke <<<< ($global:DefaultVIServer, $null)

    + CategoryInfo          : InvalidOperation: (Invoke:String) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

 

New-Object : Constructor not found. Cannot find an appropriate constructor for type VMware.VimAutomation.Client20.PermissionManagement.VCUserAccountI

mpl.

At line:10 char:29

+     Write-Output (New-Object <<<<   VMware.VimAutomation.Client20.PermissionManagement.VCUserAccountImpl  -ArgumentList $principal, "", $client)

    + CategoryInfo          : ObjectNotFound: (:) [New-Object], PSArgumentException

    + FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand

 

PowerCLI C:\>


Viewing all articles
Browse latest Browse all 223143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>