An Engineers Notebook

PowerShell Basics: Finding Commands

Find a commands

 

Get-Command |
Where-Object {$_.Name -like ‘*computer*’}

Or

Gcm | ? {$_.Name
-like ‘*computer*’}

 

List all Alias’

 

Gcm | ?
{$_.CommandType -eq ‘Alias’}

 

To make this an AND
query:

 

Gcm | ? {($_.Name
-like ‘*clear*’)  and ($_.CommandType -eq ‘cmdlet’)}

 

 

Active Directory Attribute
Filter

 

Get-ADUser | ?
{$_.Enabled -like “*Fal*”} > d:DisabledUsers.txt

 

Attributes:

DistinguishedName

Enabled

GivenName

Name

ObjectClass

ObjectGUID

SamAccountName

SID

Surname

UserPrincipalName

Leave a Reply

Your email address will not be published.