Forum Discussion
LeonWG
Aug 20, 2024Copper Contributor
AD Connect threw an exception Powershell 7
Hello,
i have an issue with powershell 7 somehow when i start manually the Azure AD sync i recieve following message:
"Start-ADSyncSyncCycle: The type initializer for 'System.Web.Util.Utf16StringValidator' threw an exception."
if i try it in Powershell 5.1 i runs perfect.
See Screenshots below.
I don't know what could be the Problem.
Powershell 7.4.4
Powershell 5.1
Hopefully someone can help me
Powershell 5.1 Version:
Powershell 7.4.4 Version:
Hi, Leon.
I'd expect - given its age - that the AAD Connect modules were not authored with PowerShell in mind (as distinct from Windows PowerShell, which is what they would have been targeting).
There's many first-party modules which fit this profile.
Try running your Import-Module like this instead.
Import-Module -UseWindowsPowerShell -Name ADSync;
This will allow it to leverage the .NET Framework rather than only what's available in .NET Core.
Cheers,
Lain
2 Replies
Sort By
- LainRobertsonSilver Contributor
Hi, Leon.
I'd expect - given its age - that the AAD Connect modules were not authored with PowerShell in mind (as distinct from Windows PowerShell, which is what they would have been targeting).
There's many first-party modules which fit this profile.
Try running your Import-Module like this instead.
Import-Module -UseWindowsPowerShell -Name ADSync;
This will allow it to leverage the .NET Framework rather than only what's available in .NET Core.
Cheers,
Lain
- LeonWGCopper Contributorruns perfect thanks for the quick response