128 Midterm Prep Flashcards
What is the basic syntax of a powershell command?
Verb-Noun
What is the use of the Get-Help command?
Get-Help provides valuable information on parameters and cmdlets in PS
What are some types of input used in PowerShell?
Strings, Ints, DateTime, Arrays
What are strings?
Strings are a series of letters and numbers that may include spaces.
You can define a string by using double quotes.
Example: “This is a string”
What are ints?
Ints are integers or whole numbers.
What is the DateTime input type?
DateTime is a string that PowerShell can interpet as a date based on your computers regional settings.
What is an array?
An array is a collection or list of strings.
You can define an array as a parameter using enpty square brackets.
Example
Param
(
[string[]$variable
)
What are some aliases for Get-Help?
help and man are both aliases for Get-Help.
What is an alias?
An alias is an alternate, usually shorter name for a cmdlet.
What is the difference between cmdlets and commands?
Cmdlets are unique to PowerShell.
Commands are a general term that covers cmdlets, functions, workflows, etc. and are not nessicarily unique to PS.
What are positional parameters?
Positional parameters are parameters that can only be passed based on the position they are inputted into a command.
Describe the basic anatomy of a PowerShell command.
Using this as an example:
Get-Eventlog -Logname ABC -ComputerName D, E -Verbose
Get-Eventlog is the name of the Cmdlet
- Logname ABC is the parameter naming the event log with the value ABC
- ComputerName -D, E is the second parameter, and is given 2 values seperated by commas
- Verbose is the final switch parameter (meaning it is not given a value.)
What are parameters always prefaced by in a command?
Parameters always have a dash (-) at the front.
-ThisIsAParameter
What are providers?
Providers are adapters. They are designed to take data storage and make it look like a disk drive.
What command is used to retrive all processes currently running on your system?
Get-Process retrieves a list of all processes.
Stop-Process is used to kill a currently running process.