# If you use this cmldlet, the screen displays the members for
a database very fast, hard to see the details
PS SQLSERVER:\sql\localhost\default\databases>
gci |
gm
# Save the result into a variable
PS SQLSERVER:\sql\localhost\default\databases>
$a= dir | gm # also can be $a =
gci | gm
# the same as before
PS SQLSERVER:\sql\localhost\default\databases>
$a
# All of the members (e.g., event, property and method) for a
database has the following members
PS SQLSERVER:\sql\localhost\default\databases>
$a | gm
<#
TypeName:
Microsoft.PowerShell.Commands.MemberDefi
Name MemberType
Definition
---- ----------
----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method
int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Definition
Property System.String
Definition {get;
MemberType
Property System.Management.Automation.P
Name
Property System.String Name
{get;}
TypeName
Property System.String TypeName
{get;}
#>
# For instance, I want to know if there is a member having
alter in it
PS SQLSERVER:\sql\localhost\default\databases>
$a | ? {$_.name -match "alter"} |fl
# Find all methods for databses
PS SQLSERVER:\sql\localhost\default\databases>
$a | ? {$_.MemberType -match
"Method"}
# Find all properties for databases
PS SQLSERVER:\sql\localhost\default\databases>
$a | ? {$_.MemberType -match
"Property"}