Section 3 Flashcards
What is a batch file
Script that is ran on DOS in sequential order
.bat is used to tell Windows that it’s an executable.
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
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.
Create a “Hello, World!” popup script this should go out to all users on the server
echo “Hello, World!”
timeout 5
or
msg * “Hello World”
- <- go to all users
Start calculator, file explorer, paint, and task manager for a script
Show DOS prompts working
timeout 5
calc
explorer
timeout 5
mspaint
timeout 5
taskmgr
timeout 5
What’s powershell’s version of man?
Show all commands (cmdlets) available
Show only commands for Active Directory
Update-Help
Get-Help remote <- or whatever command, this lists all commands that contains that
Get-Command
Get-Command -Module ActiveDirectory
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
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’
Show all computer processes like you would task manager
Show all services
Show all mapped drives
Get-Process
Get-services
Get-PSDrive
Create a simple powershell script that says “Hello, World”
notepad
echo “Hello, World”
sleep 20
save as script.ps1
Right click > run with powershell
Shutdown and restart computer via Powershell
Restart-Computer
Stop-Computer
What is PowerShell ISE
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
Open powershell ISE and type two commands but run only one of them
Clear the screen
Get-Help
Get-command
Click after the Get-Command and click green play button.
Click the scrub brush
How do you show the scripting pane in powershell ISE?
View - Show Script Pane
What is WMI
Windows Management Instrumentation
Used for scripts or applications on remote computers
Start WMI
show domain info
Show memory hardware info
Show OS info
Study about 15 commands
run wmic from DOS
enter /?
or
wmimgmt.msc < - gui add servers and stuff, right click to connect to another computer
ntdomain
memorychip
os
quit