PowerShell: Getting Started - Michael Bender Flashcards
What is Windows PowerShell?
It’s an execution engine that provides the ability for you to interface with your environment using a variety of tools
What does PowerShell ISE stand for?
Integrated Scripting Environment
What are the commands to see a directory?
ls, dir
How do you clear a screen?
cls
What is the command for finding services?
get-service
What command do you use to filter the information?
where-object, then the condition you require.
eg. get-service | where-object status -eq ‘stopped’
How do you export your results to a CSV file or txt file?
export-csv C:/powershell/services.ps1
out-file C:/powershell/services.txt
What is the syntax to request PowerShell to open a .ps1 script via notepad?
First, type notepad then the location of the file.
eg. notepad c:/powershell/services.ps1
What is the command to find more commands available in PowerShell?
Get-command
How do you change the fonts and the size of PowerShell Window?
Right click on the title of PowerShell box and choose properties
What is the command to find more commands available in PowerShell?
Get-command
How do you change the fonts and the size of PowerShell Window?
Right click on the title of PowerShell box and choose properties
What is the syntax for:
- Get Service
- Status: Stopped
- only display name, displayname and status
- Export to CSV
get-service | Where-Object {$_.status -eq “stopped”} |select-object status,name,displayname|Export-Csv C:\PowerShell\services2.ps1
Please explain the concept of “Verb - Noun” in PowerShell?
“Do Something - To Something”
Get-Verb
How can you find:
- Service
- Name starting with M
- on a specific computer/s
Get-service -name m* -ComputerName PC1,DC1
What does PowerShell search for after a -Parameter?
PowerShell searches for a value after a parameter.
-ComputerName DC1,PC1
Note: Comma allows multiple values.
How do positional parameters work?
When you’re running a command, PS will automatically use the first positional parameter.
eg. gsv m* - computername PC1,DC1
What is the syntax to get help on a parameter?
get-help get-service
Note: Here you can also see the positional parameters in the syntax section
Syntax for finding parameter with wildcard?
get-help DNS or DNS*
What is the difference between cmdlet and function?
- cmdlet is created with a code, built on .NET Framework so that it could be used.
- Function is essentially created using PS commands, cmdlets and logic
Syntax for related helpful command?
Under get-help get-service, check RELATED LINKS
Syntax for finding EXAMPLES of a PS Parameter?
get-help get-service -examples
Syntax for finding and filtering verbs available starting from “S”?
get-verb -verb s*
syntax for finding and filtering verbs by group (category)?
get-verb | where-object {$_.group -eq “Security”}