Powershell 4 Flashcards

1
Q

What command clears the Recycle Bin?

A

Clear-recyclebin

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

What Powershell command will return only the membertype ‘Method’?

User Get-Service in the example

A

Get-service | get-member -membertype method

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

If you are in a directory containg a lot of folders/files and you want to display just the first page, what command would you use?

What key will scroll a line at a time and what key will scroll a page ate a time?

A

get-childitem | more

Enter - Line at a time

Space - Page at a time

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

What command will write the contents of c:\ directory to a text file call test .txt that is located at c:\users\petej\desktop\test.txt

A

get-childitem > ‘c:\users\petej\desktop\test.txt’

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

What command will append the contents of c:\users to a text file call test .txt that is located at c:\users\petej\desktop\test.txt

A

get-childitem&raquo_space; ‘c:\users\petej\desktop\test.txt’

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

What command would write the text ‘This is Powershell’ to the text editor with a forground colour of green and a background color of blue?

A

write-host ‘This is Powershell’ -foreground green -background blue

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

What command would write the text ‘This is Powershell’ to the text editor, create a text file called log.txt in the directory you are in and write the same text to the file?

A

‘This is Powershell’ | tee-object log.txt

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

What command woukd open a text file called Music.txt that is saved in the directory you are in?

A

.\Music.txt

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

What command will retrieve the contents of the directory you are in, create a text file, write the contents of the directory to the file and save it to the same directory?

Call the text file Windows.txt

A

get-childitem > ‘windows.txt’

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

What powershell command will go back one step in a directory?

A

cd ~

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