Forum Discussion
Tomcat456
Aug 19, 2025Copper Contributor
Error setting profile for interface Primary LAN Interface
Hi all I have a problem with this script. It says "Error setting profile for interface Primary LAN Interface: The network connection profile is corrupted". I need to set the Network card Protected...
Bart_Pasmans
Aug 27, 2025Copper Contributor
Hi Tomcat456,
Though one, but I'll give it a shot non the less!
can you validate;
- The XML structure if everything is fine?
- Might be an existing profile cache
I know also that when copying thumbprints there is a 'hidden white' character at start of the line. You should check that one out as well (as this cost me a lot of time in the past)
If you have a corrupted profile you can try removing that with:
netsh lan delete profile name="Network" interface="Primary LAN Interface"
Also check if the certificate can be fetched:
Get-ChildItem Cert:\LocalMachine\Root | Where-Object { $_.Thumbprint -eq "96f2bf58b39db8b704a4dda8c5df456c725fce24" }
And check for dot3svc service:
Get-Service dot3svc (need to be running)
- SivertSolemAug 28, 2025Iron Contributor
It does appear like there's an issue with the XML indeed. First of all, <name> does not appear to be a property of <LanProfile>, so <name>$ProfName</name> should be removed entirely. (LAN_profile schema elements - Win32 apps | Microsoft Learn) Second, the <authMode>userOrComputer</authMode> is wrong. It should be "machineOrUser". (OneX element - Win32 apps | Microsoft Learn) You may also need the <PerformServerValidation>, <AcceptServerName>, and <TLSExtensions> tags as children of the <EAPType> tag. Compare with an export of a manually created and correct profile.
I've wrapped everything in a code block because this site didn't like me using tags (invalid html)