Get custom attributes from powershell RRS feed


All replies

  • Friday, January 29, 2010 3:31 AM
  • It helps me a bit, but im still stuck with how to get the custom attributes.
    i can see the right hosts in the group, but i really cant figure out what the fields are called, displayname and such that are inherrited from windows computer works great, but my custom dosnt show.
    Friday, January 29, 2010 10:07 AM
  • I got a tip about doing it like this:

    $class = get-monitoringclass | where {$_.displayname -eq 'MyCustomClass}
    $object = $class | get-monitoringobject | where {$_.displayname -eq 'myservername'}
    $object | get-monitoringobjectproperty
    $MS = $object | get-monitoringobjectproperty | where {$_.displayname -eq 'MyCustomAttribute'}

    The code used was found on http://relatedterms.com/ViewThread.aspx?t=1567730

    I now just need to figure out how i can make a list of servers in a group with displayname and asset in a table, but that should be straight forward :)

    Friday, January 29, 2010 12:02 PM
  • Michael,

    How are you discovering these extended attributes/properties in this extended class?  Via WMI, registry or script?

    If I'm reading you correctly, you're trying to create some document that lists Agent computer names, along with a some discovered inventory?
    HTH, Jonathan Almquist - MSFT
    Friday, January 29, 2010 8:43 PM
  • I am trying to get a list of my windows computers in a specific group from powershell, for use in my documentationsystem
    i can use get-agent - but the twist is that i need some attributes (AssetID and ServerLocation) in the output.
    i made a new class that inherits from windows computer.

    Boris made a script to list the groups a server was in, but i need it the other way around, with the extra attributes.

    How can i get this information?
    Thanks, Mike

    Was your question answered?  Does this help?
    HTH, Jonathan Almquist - MSFT
    Wednesday, March 10, 2010 1:14 AM
  • Hi Jonathan,

    thanks for the link.
    It looks promising, i havent looked into it yet, give me a couple of days and i will paste my complete script so far, mostly for future referencing.
    Wednesday, March 17, 2010 10:12 AM
  • Hi, sorry to bring this topic from the dead. I've been trying to filter a list by an object's extended properties but I can't seem to be able to. If I list the object with:

    Get-SCOMClass -Name 'My.Extended.Class' | Get-SCOMClassInstance | fl

    I can see things like:



    but if I try to filter (using ft or select) by any of the field in brackets [], I shows just empty space.

    I've tried attributing one object to a variable and I can even tab to the properties between brackets, but if I try to show it, I get:

    PS C:\> $agent.[Microsoft.Windows.Computer].ActiveDirectoryObjectSid
    Unable to find type [Microsoft.Windows.Computer]: make sure that the assembly containing this type is loaded.
    At line:1 char:36
    + $agent.[Microsoft.Windows.Computer] <<<< .ActiveDirectoryObjectSid
        + CategoryInfo          : InvalidOperation: (Microsoft.Windows.Computer:String) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound

    Any ideas?

    Thank you,

    Jose Fehse


    • Proposed as answer by Alexis Yakovlev Wednesday, November 20, 2013 3:39 PM
    • Unproposed as answer by Alexis Yakovlev Wednesday, November 20, 2013 3:39 PM
    Wednesday, January 9, 2013 8:31 PM
  • Hi,


    Wednesday, November 20, 2013 3:48 PM