0

Trying to export a customized WMI Namespace:

I know it is easy to query and use:

ROOT\CIMV2

Have a need to export the entire customized Namespace:

ROOT\CustomName

and then import on another computer.

Did find: https://stackoverflow.com/a/5363099/175063

I have tried the following in PowerShell:

Get-WMIObject -namespace "root" -class "__Namespace" | Select Name

But, now I need to export "CustomName" and it's class structure.

I am getting closer on this - testing (note: CIMV2, as I want to check for an export from known, good namespace. I will replace with CustomName later).

https://stackoverflow.com/a/32258127/175063

(GWMI -Namespace "root\CIMV2" -List).GetText('mof') |
    Out-File c:\scripts\file.mof

On the machine in question, we will use:

(GWMI -Namespace "root\CustomName" -List).GetText('mof') |
    Out-File c:\scripts\file.mof

Now, I need to figure out the import component.

UPDATE: It is a Windows 7 Machine and does not like the:

.GetText('mof') 

And shows us:

Method invocation failed because [System.Object[]] doesn't contain a method named 'gettext

Checking the vesion of PowerShell, we have: 2.0

On my Windows 10 system (local) it shows: 5.1.14393.2248

Leptonator
  • 3,379
  • 2
  • 38
  • 51
  • What do yoou mean by "Export"? You want to create a MOF? Or you just need to print out the structure? – EBGreen Jun 01 '18 at 18:37
  • I think MOF would be OK, or XML. I thought I have seen a couple with XML. – Leptonator Jun 01 '18 at 18:38
  • You mean something like `(gwmi CustomName -list).GetText('mof')` – EBGreen Jun 01 '18 at 19:05
  • Please see my edits to the original posting. – Leptonator Jun 01 '18 at 20:59
  • Look up a utility named mofcomp. It will let you import a class from a mof – EBGreen Jun 02 '18 at 06:29
  • Added additional edits ffrom testing on a Windows 7 client. – Leptonator Jun 04 '18 at 16:10
  • Powershell v2 is likely the issue. I would suggestr upgrading to at least 3 and ideally 5. – EBGreen Jun 04 '18 at 16:24
  • The export I am doing is from a system that is constrained from any software updates. Unfortunately, that would be a "political hot potato" that I do not want to handle!! – Leptonator Jun 04 '18 at 16:26
  • Well, Powershell v2 is nearly 9 years old. If your management wants to cripple themselves, that is their choice. If I have some time to poke around later I might look into this but right now it would require me to build a VM just to get an ancient version of Powershell running. I suggest the hot potato or not you point out to management that if they don't want to upgrade to modernstandards they probably need to start adding line items to the budget to get specialist contractors in to maintain their aging platforms... – EBGreen Jun 04 '18 at 16:42
  • With systems that are on Windows 10 - we are migrating to. We have probably close to 5000 systems and are managemed remotely. Let me see if I can go about this from Windows 10 test device. I do appreciate your help and assitance on this. – Leptonator Jun 04 '18 at 16:46

0 Answers0