7.2 Powershell Scripting Flashcards
What’s the diffrence between CMD and Powershell
Powershell was made for scripting, while CMD is short, simple and easy to learn,
Powershell in Cyber Security
Defensive security: PowerShell can be used to manage and audit logs. There are many commands for interacting with Windows Event logs. We will be looking at these later.
What is PowerShell?
PowerShell is a powerful scripting language that lets us locally and remotely manage Microsoft’s line of products.
What are objects?
“Object” is Microsoft’s name for every component in a system that PowerShell
recognizes and interacts with.
True or False:
Despite being a Microsoft product, PowerShell is open source and available on GitHub. By contrast, there’s no source code available for CMD, and writing tools are limited to batch scripts.
True
Eplain this command:
ls C:\Windows | Where-Object {$_.name -like “system”}
Uses a pipe to retrieve only objects containing the word “system”
Documentation & Find Commands
How to find documentation on a cmdlet:
Get-Help {cmdlet}
Documentation & Find Commands
To find documentation on Set-Location
:
Get-Help Set-Location
Documentation & Find Commands
Finding specific examples:
Get-Help {cmdlet} -example
Documentation & Find Commands
How to find cmdlets by noun:
Get-Command -Type Cmdlet | Sort-Object -Property Noun | Format-Table -GroupBy Noun
Documentation & Find Commands
How to find cmdlets by verb:
Get-Command -Type Cmdlet | Sort-Object -Property Verb | Format-Table -GroupBy Verb
Wildcards
How to find by noun:
Get-Command -Noun {noun}
Wildcards
How to find by verb:
Get-Command -Verb {verb}