I am running following code:
System.Management.ManagementClass wmiNetAdapterConfiguration = new System.Management.ManagementClass(\"Win32_NetworkAdapterConf
The WMI Service was running for me and I was using a Administrator account.
I got the exact same error and stacktrace when I was running a command using rsconfig.exe, eg
cd C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\
rsconfig.exe -c -s sqlserver\instance -d dbName -a SQL -u user -p pass
What I was doing wrong was the instance name has its own argument -i and this fixed it:
rsconfig.exe -c -s sqlserver -i instance -d dbName -a SQL -u user -p pass
To check the expected arguments run:
rsconfig.exe /?
Update:
This is actually incorrect, if you look at the expected arguments it states the server name has to include the instance name as well, you can't have quotes and if the instance name contains a $ sign you may need to escape it, see here for more info: https://stackoverflow.com/a/56370766/495455