Automating Administration with Windows PowerShell Flashcards

1
Q

Profile scripts are a Windows PowerShell feature that you can use to specify a list of commands that run every time you open a new Windows PowerShell session. True or False?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If you want a PowerShell profile script to be loaded for All user and for both PowerShell console and PowerShell ISE, which profile script location and file name should you use?

A

$pshome
(C:\Windows\System32\WindowsPowerShell\v1.0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write 2 methods to monitor the use of Windows PowerShell on a computer.

A

Transcript logging, module logging, script logging

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Both -in and -contains operators support exact match, partial match and pattern match. True or False?

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What command do you use to protect a users password input?

A

Read-Host “enter password here” -AsSecureString

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If the Powershell cannot run external commands, one solution is to use “stop parsing symbol”.
Write the “stop parsing symbol” syntax:

A

–%

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Windows PowerShell 5.0 logs suspicious script blocks automatically, even if script block logging is not enabled.
True or False?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List 2 applications in windows OS that can interact with PowerShell.

A

Powershell and Powershell ISE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

You wish to join multiple computers to the Adatum domain. The Add-Computer cmdlet’s -ComputerName parameter accepts multiple values. Which of the following is a set of valid values for this parameter?

A

-ComputerName LON-CL2,LON-CL3,LON-CL4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the difference between Get-Help and Get-Command?

A

Get help prints the commands documentation to screen where get command only lists available commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

PowerShell is Microsoft product, so that we cannot use it to manage Linux and macOS computers. True or False?

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following cmdlet verbs is not associated with the ADUser noun?
Get
Update
New
Remove
Set

A

update

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The default value for the -protectedFromAccidentalDeletion parameter of New-ADOrganizationalUnit is $true. True of False?

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which two parameters can you use with *-NetIPAddress cmdlets to identify a network interface?

A

-InterfaceAlias and -InterfaceIndex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What Windows feature must you install before you can use Hyper-V cmdlets?

A

Hyper-V

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which Windows PowerShell cmdlets should you pipe output to when you want to return specified properties of an object?

A

Select-Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which Windows PowerShell cmdlets should you pipe output to descending order based on specific properties?

A

Sort-Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

List the 3 basic formatting commands.

A

Format-Wide, Format-List and Format-Table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Name two techniques for pipeline parameter binding.

A

ByValue and ByPropertyName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Both Windows Management Instrumentation (WMI) and Common Information Model (CIM) support local, session based connection and ad-hoc connection. True or False?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

If you query a computer multiple times in a short period of time, a CIM session offers much better performance than an ad-hoc connection. True or False?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

All repository classes are well documented. True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

PSProviders are adapters that connect Windows Powershell to data stores. True or False?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Both Array and ArrayList support the Add() and Remove() methods. True or False?

A

False

25
Q

An array is a data structure that is designed to store a collection of items. True or False?

A

True

26
Q

What is the PowerShell script extension in PowerShell 5.0?

A

.ps1

27
Q

An organisation requires that downloaded PowerShell scripts must be signed by a trusted publisher before they can be run. However, scripts from the local computer don’t need to be signed.
Which PowerShell execution policy should you set?

A

RemoteSigned

28
Q

Break stops processing the current iteration of a loop, while Continue completely stops loop processing
True or False?

A

False

29
Q

The ______________construct is used to run a script block a specific number of times based on the: Initial state; Condition and Action

A

For

30
Q

Which one of following cmdlets is not correct to import data from external file to PowerShell?
a. $Users=Get-Content “c:\Users.txt”
b. $Users=Import-CSV “c:\Users.csv”
c. $Users=Import-CliXML “c:\Users.xml”
d. $Users=Import-JSON “c:\Users.json”

A

d

31
Q

Adding comments and help documentation to your script make it easier for others to use. True or False?

A

True

32
Q

How do you view the most recent error?

A
33
Q

A switch parameter has a value of $true or $false. True or False?

A
34
Q

When using Try..Catch construct to implement error handling, Finally section is optional. True or False?

A

True

35
Q

You can use Try..Catch and provide different responses for different error types. True or False

A

True

36
Q

Compared to dot sourcing, which technology is better to use when referencing functions in multiple scripts?

A

modules

37
Q

__ __________ allow you to pause script processing and interact with the variables in the script.

A

read-host

38
Q

For both non-terminating and terminating errors, you can use Try..Catch to display error messages in a friendly way. True or False?

A

True

39
Q

Name 3 Windows PowerShell cmdlets to import data in different formats for use in your scripts.

A

Import-Csv
Import-Clixml
Get-Content

40
Q

An Administrator creates a PowerShell script named process.ps1 and stores it in D:\
Why does administrator receive error when trying to run it using the command process.ps1?

A

They didnt specify the command path.

41
Q

Name 3 variable types.

A
42
Q

The following command is the most efficient way to produce a list of services that have names beginning with svc?
Get-Service | Where Name –like n*svc

True /False?

A

false

43
Q

Which PowerShell cmdlets are NOT correct? (Choose 2)
a. ConvertTo-CSV
b. Export-CSV
c. ConvertTo-CliXml
d. Export-CliXml
e. ConvertTo-JSON
f. Export-JSON
g. ConvertTo-HTML
h. Export-HTML

A

f and h

44
Q

When using PS Remoting, the Administrator needs to enable PS Remoting on both local and remote computers. True or False?

A

False

45
Q

When using PS Remoting, the contents of the script block or file are transmitted as literal text to the remote computers. True or False?

A

True

46
Q

Results received through remoting are static snapshot, don’t have methods or events. True or False?

A

True

47
Q

What are three types of jobs?

A

local, remote and CIM/WMI

48
Q

The Get-CIMInstance has an -AsJob parameter. True or False?

A

False

49
Q

When using Receive-Job to retrieve job results, you can use -keep to retain a copy of the results in memory. Otherwise, the results are not maintained in memory. True or False?

A

True

50
Q

Select the 3 components of a scheduled job (select 3)
a. Job definition
b. Job actions
c. Job options
d. Job principals
e. Job triggers

A

actions, triggers and principals

51
Q

The PS scheduled job results are stored in _____?

A

Both disk and memory.

52
Q

Match the PS features with their correct description:
1. Implicit remoting
2. PSSessions
3. $Using

a. It present a persistently running connection on the remote computer
b. Which is known as scope modifier, it’s used to identify a local variable in a remote command
c. Administrators do not have to install administrative tools such as Windows PowerShell commands on their local computers.

A

1-c
2-a
3-b

53
Q

ISE offers two main panes. What are they?

A

Script and console pane.

54
Q

What is the structure of the powershell cmdlet?

A

verb and noun

55
Q

What enables you to enter commands much faster and make your code less prone to errors?

A

tab completion

56
Q

Select the 3 PowerShell Active directory administration cmdlets from the list?
a) Group
b) VHD
c) VM
d) OU
e) Managing routing
f) User

A

a, d, f

57
Q

Select 2 cmdlets to manager IIS
a. New-Website
b. Get-site
c. Start-site
d. Stop-Website

A

a, d

58
Q
  1. What are the ways to send output to a file using PowerShell? Select 2 answers
    a) >
    b) «
    c) Out-file
    d) &&
    e) »
A

c, e