Add Dcom protocol via wmi properties programmatically

To use the fixed wmi port on my server I need to do the following:

1.Open Component Services

2. Open Dcom Config

3.Open Windows Management and Instrumentation Properties

4.Go to the "Endpoints" tab

5. Click Add

6. Select TCP-IP connection oriented and use a static endpoint with the selected port

I would like to do this programmatically. I tried to do it using powershell and was able to get the WMI object with this line of code:

$wmiobj = Get-WMIObject -Class Win32_DCOMApplicationSetting -Filter 'Description="Windows Management and Instrumentation"'    

      

But I didn't understand how to use this object to change settings, even after searching the web and site. I found a list of properties like AppID and LocalService name, but no methods that can be used to change the correct settings.

How can I use this object to change wmi settings like above?

Thanks in advance.

+3


source to share





All Articles