Misc. Flashcards

1
Q

& ‘.\some.exe’ /switch | Out-Null

A

Piping to Out-Null will cause the script to wait until the exe has terminated.

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

How should you run an .exe in a .ps1 script?

A

& ‘.\some.exe’ /switches

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

What is the file ext. for a Powershell script?

A

.ps1

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

Get the version of Powershell

A

$host.version

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

comment multiple lines

A

>

<#

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

Get the computer name

A

$name = Get-Content env:computerName

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

Change the background color to green

A

-backGroundColor = green

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

change the font color to black

A

-foreGroundColor = black

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

what colors work with -backGroundColor and -foreGroundColor

A

Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow DarkGray Gray Blue Green Cyan Red Magenta Yellow White

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

Call a .bat file from within a .ps1

A

.\batchfile.bat

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

Count and display no. of dirs

A

$dirs = (get-childItem “c:\path” -name).count

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

&

A

invocation operator.

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