Reputation: 13521
If I run Get-NetConnectionProfile
on 64-bit Powershell it works fine. If I run it on 32-bit Powershell I get the following error:
Get-NetConnectionProfile : Provider load failure
+ CategoryInfo : NotSpecified: (MSFT_NetConnectionProfile:root/St
andardCi...nnectionProfile) [Get-NetConnectionProfile], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041013,Get-NetConnectionProfile
This is on 64-bit Windows 8.1 with Powershell version 4.0.
Upvotes: 10
Views: 9150
Reputation: 3669
As x0n points out, you need to run the script in 64-bit PowerShell.
ggz's answer (for a similar problem) suggests adding this to the top of the script, which will rerun the script in 64-bit for you:
if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
$powershell=$PSHOME.tolower().replace("syswow64","sysnative").replace("system32","sysnative")
if ($myInvocation.Line) {
&"$powershell\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line
} else {
&"$powershell\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args
}
exit $lastexitcode
}
# Your script code ...
Upvotes: 0
Reputation: 52450
It's not meant to work on the 32bit shell. Frankly, it shouldn't even allow you to load the module. These commands use core operating system libraries. Since the core o/s is 64bit, the process trying to load these libraries must also be 64 bit. I hope this makes sense.
Upvotes: 12