HELP!!! How to do a WMI SUPERCLASS reference using POWERSHELL


hi friends,

i'm developing wmi subclass , reference superclass subclass.

i know mof code is:

class mysubclass : __superclass

how can same using powershell?

my ps code is:

$newclass = new-object system.management.managementclass ("root\mysubclass", "root\mysubclass\__superclass", $null);
$newclass['__class'] = "mysubclass"
$newclass.properties.add('name', [system.management.cimtype]::string, $false)
$newclass.properties['name'].qualifiers.add('key', $true)

thanks

tavares


[system.management.managementclass]::new(<namespace crete in>, < fullpath new class>,<options>)

add ":superclass" new class name set class derive from.

$myderivedclass = [system.management.managementclass]::new('root\cimv2', 'root\cimv2\myderivedclass:win32_environment', $null) $myderivedclass.__class = 'myderivedclass' # add properties , methods $myderivedclass.put() 



\_(ツ)_/




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...