Introduction
PowerShell Commands
More Commands
Syntax
Pipelines
100

What is the extension of PowerShell script files?

PS1

100

What are built in commands in the PowerShell known as?

cmdlets

100

I want to retrieve all services that have the word "windows" in them. How?

 Get-Service -Name *windows* 

100

$c = 100
$d = 200
$e = $c -gt $d
$e.GetType()

What is the type and value of the variable $e?

boolean

False

100

Which parameter does each cmdlet accept?

-Property

200

How would you get the date 45 days ago in powershell?

Get-Date.AddDays(-45)

200

What is the recommended syntax (structure) for PowerShell command.

Verb-Noun

Do something-To something

200

What is the alias of Get-ChildItem

dir

200

$colors = @("Orange","Yellow","Green","Blue","Indigo")

$colors.GetType()

What is the type of the $colors variable?

An array

200

What will Measure-Object do?

Counts # of objects in collection

300

What do PowerShell commands accept and return to the user?

PowerShell returns objects.

300

What is the PowerShell verb that is useful when you want information about something on your system?

Get

300

How would you get the properties and methods of a variable? 

Get-Member or Tab completion

300

$var = @{Name = "Ian"; Age = 37; Height = 5.9} 

$var.gettype()


What type is the $var variable?

Hash Table
300

What is the comparison operator for equal to?

-eq

400

What is the underlying technology that PowerShell is built on top of?

.NET

400

How can you use help to get examples about get-service?

get-help get-service -examples

400

What would you use to display the text to the user "Have a great Day"?

Write-Host

400

[int] $value = 100
$value = "Student"

Do the above commands work? Why?

No, $value is defined as an integer. A string cannot be assigned to the variable.

400

What (2) build-in variables are used to reference the object that was piped into the command?

$PSItem or $_

500

What operator makes an object recognized as a variable in powershell?

$

500

You want to get all commands that can control you DHCP server. What command would you use?

Get-Command –Noun *DHCP*

500

What does the following command do?

Get-Process | Where-Object {$_.WorkingSet -gt 20000000}

Return all processes, loop over them and select only the ones that have WorkingSet  greater than the specified value.

500

$x = 100
$y = 200
Write-Host "`$x + `$y= " $x + $y
Write-Host "`$x + `$y= " ($x + $y)

What is the difference? What is the output?

$x + $y=  100 + 200

$x + $y=  300

() provide priority to do the math operation.

500

This comparison operator is incorrect 

Wildcard equality = -we

Provide the correct one?

-like

M
e
n
u