Set-DnsClientGlobalSetting – throwing “Access to a CIM resource was not available”

active-directoryinternal-dnswindows 10

I am trying to add a Suffix to list of existing domains on my workstation but am getting this error.
I am running PowerShell as an administrator and still, the error persists. I have domains ABC and DEF in the list and want to add xyz.

Set-DnsClientGlobalSetting -SuffixSearchList @("abc.com", "def.com", "xyz.com")

Edit: This is the full error.
Set-DnsClientGlobalSetting : Access to a CIM resource was not available to the client.
At line:1 char:1
+ Set-DnsClientGlobalSetting -SuffixSearchList @("abc.com", " …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (MSFT_DNSClientG…nstanceID = ""):ROOT/StandardCi…ntGlobalSetting) [Set-DnsClientGlobalSetting], CimException
+ FullyQualifiedErrorId : MI RESULT 2,Set-DnsClientGlobalSetting

Any ideas would be appreciated.

Best Answer

I believe this is because you have a GPO defining the DNS suffix search list.

I was able to validate this in my environment by having a computer in a test OU and test GPO assigned to it with the DNS suffix search list setting disabled. Make sure this test GPO takes precedence over other GPOs that may define the DNS suffix search list.

After ensuring a GPO wasn't defining the DNS suffix search list, this command should as expected.