Section 3 Flashcards

1
Q

What is a batch file

A

Script that is ran on DOS in sequential order

.bat is used to tell Windows that it’s an executable.

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

If we create a script that displays the directory on it’s own, what will happen and how do we fix it?

Create this file

A

It will display for just a moment before closing the command line. To workaround this you can use a command like:
timeout 5
to keep that from happening for 5 seconds.

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

Create a “Hello, World!” popup script this should go out to all users on the server

A

echo “Hello, World!”
timeout 5

or

msg * “Hello World”

  • <- go to all users
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Start calculator, file explorer, paint, and task manager for a script
Show DOS prompts working

A

timeout 5
calc
explorer
timeout 5
mspaint
timeout 5
taskmgr
timeout 5

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

What’s powershell’s version of man?

Show all commands (cmdlets) available

Show only commands for Active Directory

A

Update-Help

Get-Help remote <- or whatever command, this lists all commands that contains that

Get-Command

Get-Command -Module ActiveDirectory

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

List all file in folder via powershell

Create a folder called “shows”

Create a folder in “shows” called “Seinfeld”

Create a file named “Jerry” in “Seinfled”

Copy “Jerry” and past it in Desktop

Remove the copied file

A

Get-ChildItem -Path C:\

New-Item -Path ‘C:\shows’ -ItemType Directory

New-Item -Path ‘C:\shows\Seinfeld’ -ItemType Directory

New-Item -Path ‘C:\shows\Seinfeld\jerry’ -ItemType File

Copy-Item -Path ‘C:\shows\Seinfeld -Destination ‘C:\Users\Administrator\jerry.bak’

Remove-Item -Path ‘C:\Users\Administrator\jerry.bak’

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

Show all computer processes like you would task manager

Show all services

Show all mapped drives

A

Get-Process

Get-services

Get-PSDrive

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

Create a simple powershell script that says “Hello, World”

A

notepad
echo “Hello, World”
sleep 20
save as script.ps1
Right click > run with powershell

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

Shutdown and restart computer via Powershell

A

Restart-Computer
Stop-Computer

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

What is PowerShell ISE

A

Power Shell Integrated Scripting Environment.

GUI that allows you to easily create different scripts without having to type all the commands.

You can run commands, write and test scripts.

Multiline editing, tab completion, syntax coloring, selective execution, context-sensitive help, and support for right to left languages

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

Open powershell ISE and type two commands but run only one of them

Clear the screen

A

Get-Help
Get-command
Click after the Get-Command and click green play button.

Click the scrub brush

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

How do you show the scripting pane in powershell ISE?

A

View - Show Script Pane

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

What is WMI

A

Windows Management Instrumentation

Used for scripts or applications on remote computers

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

Start WMI

show domain info

Show memory hardware info

Show OS info

Study about 15 commands

A

run wmic from DOS
enter /?

or

wmimgmt.msc < - gui add servers and stuff, right click to connect to another computer

ntdomain
memorychip
os

quit

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