1

When I run the below PowerShell command on a Windows Server 2016 Standard host I get the following error:

Get-WmiObject -query ('SELECT * FROM Win32_DCOMApplicationSetting WHERE AppId = "{00020906-0000-0000-C000-000000000046}"') -EnableAllPrivileges
Get-WmiObject : Invalid class "Win32_DCOMApplicationSetting"
At line:1 char:1
+ Get-WmiObject -query ('SELECT * FROM Win32_DCOMApplicationSetting WHE ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidType: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

The host has Microsoft Office 2016 installed and the AppId GUID refers to the Microsoft Excel Application DCOM application.

I have several other identical hosts, and the command completes successfully on those. What might be causing the problem on this host?

3
  • 1
    See here if its present here Get-WmiObject -Namespace "root\cimv2" -List | Where-Object { $_.Name -like "*DCOM*" } or not. Maybe the DCOM is removed or not registered for excel. You can also check in dcomcnfg Commented Sep 18 at 14:58
  • Hi @RanadipDutta, it isn't listed by that command. The DCOM UI seems to be working fine, but I would like to be able to apply the configuration via PowerShell script. Thanks Commented Sep 18 at 20:00
  • 1
    a note: the Wmi cmdlets have been deprecated since Powershell 3, use the Cim ones instead learn.microsoft.com/en-us/powershell/scripting/learn/ps101/… Commented Sep 19 at 6:46

1 Answer 1

1

The following command shell script (from https://techcommunity.microsoft.com/blog/askperf/wmi-rebuilding-the-wmi-repository/373846) seems to have resolved the issue:

@echo off
sc config winmgmt start= disabled
net stop winmgmt /y
%systemdrive%
cd %windir%\system32\wbem
for /f %%s in ('dir /b *.dll') do regsvr32 /s %%s
wmiprvse /regserver
sc config winmgmt start= auto
net start winmgmt
for /f %%s in ('dir /s /b *.mof *.mfl') do mofcomp %%s
Sign up to request clarification or add additional context in comments.

1 Comment

Thats nice. *.mof and *.mfl is absolutely stunning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.