"Get-ContentLibrary" cmdlet might fail in PowerCLI 12.0.0
search cancel

"Get-ContentLibrary" cmdlet might fail in PowerCLI 12.0.0


Article ID: 326190


Updated On:


VMware vSphere ESXi


  • When trying to run the cmdlet "Get-ContentLibray" in PowerCLI 12.0.0 the execution fails, instead an error message is displayed similar to:
    Get-ContentLibrary : 5/12/2020 4:52:05 PM       Get-ContentLibrary              An error occurred while trying to get content libraries
    by names. For more details check the inner exception.
    At line:1 char:1
    + Get-ContentLibrary
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Get-ContentLibrary], CisException
        + FullyQualifiedErrorId : ViCore.Impl.V1.Service.ContentLibrary.ContentLibraryImpl.GetContentLibraryNonWildcardNames.Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ContentLibrary.GetContentLibrary
  • The error details contain the following information:
    PS C:\> $error[0].exception | select *
    ErrorId : ViCore.Impl.V1.Service.ContentLibrary.ContentLibraryImpl.GetContentLibraryNonWildcardNames.Error
    ErrorCategory : NotSpecified
    TargetObject :
    RecommendedAction :
    SessionId :
    ConnectionId :
    Severity : Error
    Message : 5/27/2020 1:15:39 PM Get-ContentLibrary An error occurred while trying to get content libraries
    by names. For more details check the inner exception.
    Data : {ParameterValues}
    InnerException : System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json,
    Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
    The system cannot find the file specified.
Note: The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.


This issue is caused when NewtonSoft.Json.dll, was not properly registered when PowerCLI was installed.
or when another version of the library was already installed on the local system and PowerCLI failed to update it during its own installation, because it was in use by another application.


To resolve this issue, NewtonSoft.Json.dll should be register to the Global Assembly Cache of the Windows-System by running the following commands in PowerShell:
# [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
# $publish = New-Object System.EnterpriseServices.Internal.Publish
# $publish.GacInstall("C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Common\\net45\Newtonsoft.Json.dll ")

Additional Information

This article was specifically published for PowerCLI 12.0.0
Should you experience similar issues in a later PowerCLI version, please contact the VMware Support team by opening a support request