Hi all,
We had patches installed on our Adaxes 2018.2, 2008 R2 server the other night. As part of that, Windows Management Framework 5.1 (KB319566) was installed.
This patch seemed to break Adaxes powershell scripting in our environment. When attempting to run a custom command or scheduled task we got the following error:
The following error occurred while loading the extended type data file:
Microsoft.PowerShell.Core,
C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(260): Error in type "System.IO.DirectoryInfo": The member BaseName is already present.
Microsoft.PowerShell.Core,
C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(253): Error in type "System.IO.DirectoryInfo": The member BaseName is already present.
[Repeat a bunch more times for different lines in the file]
Copying the full error out of the output log we got:
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(260) : Error in type "System.IO.DirectoryInfo": The member BaseName is already present. Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(253) : Error in type "System.IO.DirectoryInfo": The member Mode is already present. Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(269) : Error in type "System.IO.DirectoryInfo": Exception: Cannot convert the "Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods" value of type "System.String" to type "System.Type". Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(276) : Error in type "System.IO.DirectoryInfo": Exception: Cannot convert the "Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods" value of type "System.String" to type "System.Type". Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(280) : Error in type "System.IO.DirectoryInfo": The member PSStandardMembers is already present. Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(301) : Error in type "System.IO.FileInfo": The member VersionInfo is already present. Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(307) : Error in type "System.IO.FileInfo": The member BaseName is already present. Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(294) : Error in type "System.IO.FileInfo": The member Mode is already present. Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(316) : Error in type "System.IO.FileInfo": Exception: Cannot convert the "Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods" value of type "System.String" to type "System.Type". Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(323) : Error in type "System.IO.FileInfo": Exception: Cannot convert the "Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods" value of type "System.String" to type "System.Type". Microsoft.PowerShell.Core, C:\Windows\System32\WindowsPowerShell\v1.0\typesv3.ps1xml(327) : Error in type "System.IO.FileInfo": The member PSStandardMembers is already present. Stack trace: at <ScriptBlock>, <No file>: line 1
To fix;
- We first had to uninstall Windows Management Framework 5.1 and restarted.
- Powershell seemed to be a little broken after the restart so we also removed Window Management Framework 4 and restarted.
- Re-installed Window Management Framework 4 and restarted.
- Got the error "Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." so rebooted again.
- Adaxes is now happy again.
Just though I would share in case anyone else encounters this issue or has anything else to add.
EDIT: We found a workaround to allow Adaxes to work with WMF 5.1 installed:
create powershell.exe.config with following:
<?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0.30319"/> <supportedRuntime version="v2.0.50727"/> </startup> </configuration>
Copy the file into powershell root directory.[C:\Windows\System32\WindowsPowerShell\v1.0]
- Run following from command line
reg add hklm\software\microsoft.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1
reg add hklm\software\wow6432node\microsoft.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1
Ref: https://social.technet.microsoft.com/Forums/lync/en-US/0a7c1c22-6817-44db-b83c-3a0696611ddd/could-not-load-file-or-assembly-systemmanagementautomation-version3000?forum=virtualmachinemanager