How can I view the methods associated with an object? ⚓︎

Let’s say that you have a variable that contains a string:

$a = "abc"

That’s neat but what if I want to view the possible methods that are available on the string object? You can use the Get-Member cmdlet. You can also use the shorthand version gm.

$a = "abc"
$a | gm
// Name | MemberType | Definition
// Clone | Method | System.Object Clone() [...]
// ...
// Length | Property | int Length {get;}
// 3

You can also view the static methods associated with an object too:

"abc" | gm - Static
// Compare | Method | static int Compare(string strA, string strB)...

You can check if a character contains a string by using the cmatch operator like so:

$word = "Hello"
$word -cmatch "[A-Z]"
// True
Search ActiveDirectory

Before you can query AD, you need to first import the Active Directory module

import-module activedirectory