OpsaC - Operating as PowerShell code
published: May 2, 2024 author: Tinu tags: VMware categories: PowerShell
PowerCLI Get-Tag fails with ‘Could not load file or assembly ‘Newtonsoft.Json, Version=10.0.0.0’
Wird nach dem connecten auf ein vCenter die Tags ausgelesen, schlägt dies mit Could not load file or assembly ‘Newtonsoft.Json’ fehl.
Connect-VIServer ...
Get-Tag
11/10/2018 21:06:20 Get-Tag 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.
SBC PureConsult hat dies bereits im Oktober 2018 analysiert und einen Workaround aufgelistet.
Retrieve the newer version of the file (supplied with the PowerCLI modules), located for instance in:
C:\Users\username\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\net45
and place a copy in somewhere PowerShell is likely to find it, e.g.:
C:\Windows\System32\WindowsPowerShell\v1.0\Newtonsoft.Json.dll
This simple work-around proved successful for me, but you should check of course to verify all other functionality which might depend on this file before making a similar change in a production environment.