I'm trying to browse all of the items in a sql server object.
I'm working with a SQL server cluster and am using this code (lifted from another page) to get the values from 2 specific items.
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Smo') | out-null;
$srv = New-Object 'Microsoft.SqlServer.Management.Smo.Server' $cluster_name;
$properties = $srv.Properties
$owner_node = $properties.Item('ComputerNamePhysicalNetBIOS').Value;
$is_clustered = $properties.Item('IsClustered').Value
This led me to wonder: How would I browse the other items in this object?
When I try "$properties | get-member" , it just returns:
TypeName: Microsoft.SqlServer.Management.Smo.Property
Name MemberType Definition
---- ---------- ----------
CompareTo Method int CompareTo(System.Object obj)
Equals Method bool Equals(System.Object o)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Dirty Property System.Boolean Dirty {get;}
Expensive Property System.Boolean Expensive {get;}
IsNull Property System.Boolean IsNull {get;}
Name Property System.String Name {get;}
Readable Property System.Boolean Readable {get;}
Retrieved Property System.Boolean Retrieved {get;}
Type Property System.Type Type {get;}
Value Property System.Object Value {get;set;}
Writable Property System.Boolean Writable {get;}
The same result is returned when I try "$properties.item | get-member".
Best Answer
If I understand correctly you want to know what other properties you can access using similar code as
$properties.Item('ComputerNamePhysicalNetBIOS').Value
? If that's the case you can get a list of those properties using