Forum Discussion
Powershell - Set-VpnConnectionIPsecConfiguration : Invalid namespace
The default Windows built in L2TP client uses 3DES, and for VPN connection I need to use AES to AES256, so I found command to use Powershell to edit a connection:
Set-VpnConnectionIPsecConfiguration -ConnectionName L2TP -AuthenticationTransformConstants SHA196 -CipherTransformConstants AES128 -DHGroup Group14 -EncryptionMethod AES128 -IntegrityCheckMethod SHA1 -PfsGroup PFS2048 -ForceThis does work on a test machine, I was able to connect to a Cisco ASA. My problem is on the PC that needs VPN connections I get this error:
Set-VpnConnectionIPsecConfiguration : Invalid namespace At line:1 char:1 + Set-VpnConnectionIPsecConfiguration -ConnectionName L2TP -Authenticat ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : MetadataError: (PS_VpnConnectionIPsecConfiguration:root/Microsoft/...ecConfiguration) [Set-VpnConnectionIPsecConfiguration], CimException + FullyQualifiedErrorId : HRESULT 0x8004100e,Set-VpnConnectionIPsecConfiguration
Not much of a Windows user, even less so with Powershell. Googling 'Invalid namespace' to 'CIMexception' has not gotten me anywhere, and I have yet to find anything specific to someone else encountering this error when modifying VPN connection. I also get this Invalid namespace when trying to add a new connection via Powershell as well.
5 Replies
- What version of PowerShell are you running? 5 or 7? And x86 or x64? Are both Windows versions the same? (Windows 10/11, build?)
- SeanWaiteCopper ContributorPSVersion 5.1.19041.4648
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.4648
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
My desktop at the office and laptop are the same Windows version 10.xx It is just the laptop (which I would use a VPN client) is not accepting these commands.
If there was another means of editing the VPN connection I would just use that, goal is to reconfigure the default 3DES that Windows defaults to using. I have not found any software package or registry edit option so I am left with having to use this PS command.- LainRobertsonSilver Contributor
Because WMI operates independently from PowerShell, you will get the same result from Windows PowerShell x86 and x64.
You can run the following command as a manual test, where if the namespace does exist, you will simply get a null response (i.e. nothing will be returned, including no errors):
Get-CimInstance -ClassName PS_VpnConnectionIPsecConfiguration -Namespace root/Microsoft/Windows/RemoteAccess/Client;However, I would anticipate that you will get the same "invalid namespace", in which case perhaps there's something that can be done about it, perhaps not - I haven't looked yet.
You've noted the Windows 10 version is the same, but what about the Windows Edition? You can quickly check by typing:
winver
Windows Enterprise and Education are the most fully-featured. Then you step back in some areas for Windows Professional. Lastly, Windows Home is a big step backwards in features.
I can't say that I remember all the differences between editions, but if it's Home, it wouldn't surprise me if the namespace is missing by design.
But if you're running Enterprise or Professional, it seems more likely something has gone wrong with your WMI repository and you'll need to look at other actions such as re-adding a missing MOF, running a repair using sfc.exe or, in the worst case, potentially rebuilding the full MOF cache. But I won't explain any of that until there's a point in doing so, as I'd have to do some digging and refreshing of my own memory first anyway.
Cheers,
Lain