Symptoms:
Get-ContentLibrary : YYYY-MM-DD 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
PS C:\> $error[0].exception | select *
ErrorId : ViCore.Impl.V1.Service.ContentLibrary.ContentLibraryImpl.GetContentLibraryNonWildcardNames.Error
ErrorCategory : NotSpecified
TargetObject :
RecommendedAction :
SessionId :
ConnectionId :
Severity : Error
Message : YYYY-MM-DD 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=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
The system cannot find the file specified.
(...)
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=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
# $publish = New-Object System.EnterpriseServices.Internal.Publish
# $publish.GacInstall("C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Common\12.0.0.15939652\net45\Newtonsoft.Json.dll ")