Day 2
Welcome to Day 2 of the IT Crash Course! Today, we will focus on Windows configuration, system maintenance, and command-line interfaces. By the end of this day, you will have a solid understanding of networking basics, system troubleshooting, and scripting in Windows environments.
Agenda
- Day 2
- Agenda
- Windows Configuration and System Settings (continued)
- Windows Networking Basics
- Connecting to Networks
- Configuring Network Settings
- Activities: Connect to Wi-Fi, Set Static IP, Change Network Profile, and Troubleshoot
- Windows Maintenance and Troubleshooting
- System Updates and Patches
- Troubleshooting Common Issues Using Built-in Tools
- Activities: Windows Update, Troubleshooters, Event Viewer, Disk Cleanup, Task Manager
- Shells: Windows (CMD, PowerShell)
- Introduction to Command-Line Interfaces
- Understanding the Role of Shells
- Navigating the File System Using CMD
- Basic CMD Commands
- File and Directory Operations
- Utilizing Environment Variables
- Activities: Navigate Directories, Manage Files and Folders, Use Environment Variables
- PowerShell Scripting Basics
- Introduction to PowerShell
- PowerShell Scripting Introduction
- Activities: PowerShell Scripting Basics
- Practical Exercises and Q\&A Day 2
- Additional Resources
- Key Takeaways
Windows Configuration and System Settings (continued)
Windows Networking Basics
Connecting to Networks
Networking is crucial for enabling communication between computers and accessing the internet. Understanding how to connect a Windows machine to various networks is essential.
- Types of Networks:
- Wired Networks: Use Ethernet cables to connect directly to routers or switches.
- Wireless Networks (Wi-Fi): Connect to networks without physical cables using wireless signals.
- Connecting to a Wi-Fi Network:
- Steps:
- Access Network Icon: Click on the Network icon in the system tray (usually found at the bottom-right corner).
- Select Network: A list of available Wi-Fi networks will appear. Choose the desired network.
- Enter Password: If the network is secured, you will be prompted to enter a password.
- Connect Automatically: Optionally, check the box to connect automatically when the network is in range.
- Connect: Click Connect to establish the connection.
- Connecting to a Wired Network:
- Steps:
- Plug in Ethernet Cable: Connect one end to your computer's Ethernet port and the other to a router or modem.
- Automatic Connection: Windows should automatically detect and connect to the network.
- Troubleshooting Connection Issues:
- Check Physical Connections: Ensure all cables are securely connected.
- Verify Network Adapter Status:
- Open Device Manager: Right-click Start > Device Manager.
- Expand Network adapters and ensure the adapter is enabled.
- Use Network Troubleshooter:
- Go to Settings > Network & Internet > Status.
- Click Network troubleshooter.
Configuring Network Settings
Customizing network settings allows for more control and can help troubleshoot connectivity issues.
- Accessing Network Settings:
- Settings App:
- Go to Settings > Network & Internet.
- Select Wi-Fi or Ethernet, depending on your connection type.
- Control Panel:
- Open Control Panel > Network and Sharing Center.
- Click Change adapter settings on the left sidebar.
- Changing IP Settings:
- Automatic (DHCP):
- Default setting where the network assigns an IP address automatically.
- Manual (Static IP):
- Steps:
- Right-click your network adapter and select Properties.
- Select Internet Protocol Version 4 (TCP/IPv4) and click Properties.
- Choose Use the following IP address.
- Enter the IP address, Subnet mask, and Default gateway.
- Enter Preferred DNS server and Alternate DNS server if necessary.
- Configuring Network Profiles:
- Private Network:
- Suitable for home or trusted networks.
- Enables device discovery and file sharing.
- Public Network:
- Ideal for public places like cafes.
- Disables discovery and sharing for security.
- Changing Network Profile:
- Go to Settings > Network & Internet > Wi-Fi or Ethernet.
- Click on the connected network and select Public or Private.
- Advanced Settings:
- Proxy Settings:
- Configure a proxy server if required by the network.
- Found under Settings > Network & Internet > Proxy.
- VPN Configuration:
- Set up a Virtual Private Network for secure remote access.
- Found under Settings > Network & Internet > VPN.
Activities: Connect to Wi-Fi, Set Static IP, Change Network Profile, and Troubleshoot
45-60 minutes
- Connect to a Wi-Fi Network (15 minutes):
- Objective: Practice connecting to a wireless network.
- Instructions:
- Use the network icon to find and connect to a Wi-Fi network.
- Enter the password if required.
- Toggle the Connect automatically option.
- Set a Static IP Address (20 minutes):
- Objective: Learn to manually configure IP settings.
- Instructions:
- Access your network adapter's properties.
- Manually enter an IP address, subnet mask, and default gateway.
- Test connectivity by pinging another device or website.
- Change Network Profile (10 minutes):
- Objective: Understand the impact of network profiles.
- Instructions:
- Switch between Public and Private profiles.
- Observe changes in network discovery and sharing settings.
- Network Troubleshooting (15 minutes):
- Objective: Use built-in tools to diagnose issues.
- Instructions:
- Disable your network adapter and attempt to connect to the internet.
- Run the Network troubleshooter to identify and fix the problem.
Windows Maintenance and Troubleshooting
System Updates and Patches
Regular updates keep your system secure and running smoothly.
- Accessing Windows Update:
- Go to Settings > Update & Security > Windows Update.
- Click Check for updates to search for new updates.
- Types of Updates:
- Quality Updates: Security fixes, bug fixes, and minor improvements.
- Feature Updates: Major updates introducing new features and enhancements.
- Configuring Update Settings:
- Automatic Updates: Windows installs updates automatically by default.
- Pause Updates: Temporarily stop updates for up to 35 days.
- Change Active Hours: Set times when you're typically using the device to prevent automatic restarts.
- Viewing Update History:
- See a list of installed updates.
- Uninstall problematic updates if necessary.
Troubleshooting Common Issues Using Built-in Tools
Windows offers several tools to help diagnose and fix system problems.
- Troubleshooters:
- Access: Settings > Update & Security > Troubleshoot.
- Common Troubleshooters:
- Internet Connections
- Audio Playback
- Printer
- Windows Update
- Event Viewer:
- Purpose: View detailed logs about system events.
- Access: Right-click Start > Event Viewer.
- Usage:
- Check Windows Logs for Application, Security, and System events.
- Identify errors and warnings.
- System Restore:
- Purpose: Revert your system to a previous state without affecting personal files.
- Access: Right-click This PC > Properties > System Protection > System Restore.
- Usage:
- Choose a restore point and follow the prompts.
- Disk Cleanup and Defragmentation:
- Disk Cleanup:
- Removes unnecessary files to free up space.
- Access via Start > Disk Cleanup.
- Disk Defragmenter:
- Rearranges fragmented data for improved performance (mainly for HDDs).
- Access via Start > Defragment and Optimize Drives.
- Task Manager:
- Purpose: Monitor system performance and manage processes.
- Access: Press Ctrl + Shift + Esc.
- Usage:
- Processes Tab: View running applications and background processes.
- Performance Tab: Monitor CPU, memory, disk, and network usage.
- Startup Tab: Manage programs that run on startup.
Activities: Windows Update, Troubleshooters, Event Viewer, Disk Cleanup, Task Manager
45-60 minutes
- Run Windows Update (15 minutes):
- Objective: Ensure your system is up to date.
- Instructions:
- Check for updates and install any available.
- Set active hours to prevent unexpected restarts.
- Use Troubleshooters (15 minutes):
- Objective: Resolve common issues.
- Instructions:
- Simulate a problem, such as disabling a device.
- Run the appropriate troubleshooter to fix it.
- Explore Event Viewer (10 minutes):
- Objective: Learn to read system logs.
- Instructions:
- Open Event Viewer and navigate through different logs.
- Identify any errors or warnings and discuss possible causes.
- Perform Disk Cleanup (10 minutes):
- Objective: Free up disk space.
- Instructions:
- Run Disk Cleanup and select files to delete.
- Note the amount of space recovered.
- Monitor System Performance (10 minutes):
- Objective: Use Task Manager to understand resource usage.
- Instructions:
- Open Task Manager and observe CPU and memory usage.
- Identify any processes consuming excessive resources.
Shells: Windows (CMD, PowerShell)
Introduction to Command-Line Interfaces
Understanding the Role of Shells
Shells provide a way to interact with the operating system via text commands.
-
Command Prompt (CMD):
-
The traditional command-line interface in Windows.
-
Executes DOS-based commands.
-
PowerShell:
-
A more advanced shell with powerful scripting capabilities.
-
Built on the .NET framework.
-
Benefits of Using Shells:
- Efficiency: Faster execution of tasks without navigating GUIs.
- Automation: Ability to write scripts to automate repetitive tasks.
- Control: Access to advanced system settings and configurations.
Navigating the File System Using CMD
-
Opening Command Prompt:
-
Method 1: Search for Command Prompt in the Start menu.
-
Method 2: Press Windows Key + R, type
cmd, and press Enter. -
Basic Navigation Commands:
dir: Lists files and directories in the current directory.- Example:
dir
- Example:
cd: Changes the current directory.- To move to a directory:
cd FolderName - To move up one level:
cd .. - To change drive:
D:(switches to D drive)
- To move to a directory:
cls: Clears the command prompt screen.echo: Displays messages.- Example:
echo Hello World
- Example:
Basic CMD Commands
File and Directory Operations
-
Creating a Directory:
-
mkdir [directory_name]ormd [directory_name]- Example:
mkdir Projects
- Example:
-
Deleting a Directory:
-
rmdir [directory_name]orrd [directory_name]- To delete a directory and its contents:
rmdir /s [directory_name]
- To delete a directory and its contents:
-
Creating a File:
-
copy con [filename]- Type the content and press Ctrl + Z to save.
- Example:
copy con notes.txt
-
Deleting a File:
-
del [filename]- Example:
del notes.txt
- Example:
-
Copying Files:
-
copy [source] [destination]- Example:
copy file.txt D:\Backup\
- Example:
-
Moving/Renaming Files:
-
move [source] [destination]- Example:
move file.txt D:\Documents\
- Example:
-
Viewing File Content:
type [filename]- Example:
type notes.txt
- Example:
Utilizing Environment Variables
Environment variables are placeholders that store system values.
-
Common Environment Variables:
-
%PATH%: Directories where executable files are located. %USERPROFILE%: Path to the current user's home directory.-
%TEMP%: Path to the temporary files directory. -
Displaying Environment Variables:
-
echo %VARIABLE_NAME%- Example:
echo %USERPROFILE%
- Example:
-
Setting Environment Variables:
set VARIABLE_NAME=value- Sets a variable for the current session.
- Example:
set MYVAR=TestValue
setx VARIABLE_NAME value- Sets a variable permanently.
Activities: Navigate Directories, Manage Files and Folders, Use Environment Variables
60 minutes
- Navigate Directories (15 minutes):
- Objective: Practice moving around the file system.
- Instructions:
- Use
cdto navigate to different directories. - Use
dirto list contents.
- Use
- Manage Files and Folders (20 minutes):
- Objective: Create and manipulate files and directories.
- Instructions:
- Create a new directory:
mkdir TestFolder. - Create a file:
copy con testfile.txt. - Write content and save.
- Move the file to
TestFolder:move testfile.txt TestFolder. - Delete the file:
del TestFolder\testfile.txt. - Remove the directory:
rmdir TestFolder.
- Create a new directory:
- Use Environment Variables (15 minutes):
- Objective: Utilize system variables in commands.
- Instructions:
- Navigate to your desktop using:
cd %USERPROFILE%\Desktop. - Display the PATH variable:
echo %PATH%.
- Navigate to your desktop using:
- Explore Help Commands (10 minutes):
- Objective: Learn to get help on commands.
- Instructions:
- Use
helpto list available commands. - Use
help [command]for details on a specific command. - Example:
help dir
- Use
PowerShell Scripting Basics
Introduction to PowerShell
PowerShell is a powerful scripting language and shell framework.
-
Advantages over CMD:
-
Access to .NET Framework.
- Advanced scripting capabilities.
-
Consistent syntax and powerful cmdlets.
-
Opening PowerShell:
-
Search for PowerShell in the Start menu.
-
Right-click and select Run as administrator if elevated privileges are needed.
-
Basic Cmdlets:
Get-Command: Lists all available cmdlets.Get-Help [cmdlet]: Displays help for a cmdlet.- Example:
Get-Help Get-Process
- Example:
Get-Service: Lists all services on the system.Set-ExecutionPolicy: Changes the script execution policy.
PowerShell Scripting Introduction
Writing Simple Scripts
-
Creating a Script File:
-
Use a text editor like Notepad or the built-in PowerShell ISE.
-
Save the file with a
.ps1extension. -
Example Script (
HelloWorld.ps1):
Write-Host "Hello, World!"
-
Running a Script:
-
Navigate to the script's directory in PowerShell.
-
Execute with
.\HelloWorld.ps1. -
Script Execution Policy:
- Execution Policies:
- Restricted: No scripts can be run.
- AllSigned: Only scripts signed by a trusted publisher can be run.
- RemoteSigned: Scripts created locally run; downloaded scripts must be signed.
- Unrestricted: All scripts run with a warning.
- Changing Policy:
- Set policy for current user:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Set policy for current user:
Automating Tasks Using PowerShell
-
Variables:
-
Declared using
$. -
Example:
$greeting = "Hello, PowerShell!" -
Control Structures:
-
If Statement:
if ($condition) {
# Code to execute if condition is true
} else {
# Code to execute if condition is false
}
-
Loops:
-
For Loop:
for ($i = 0; $i -lt 5; $i++) {
Write-Host "Iteration $i"
}
- Foreach Loop:
$items = 1..5
foreach ($item in $items) {
Write-Host "Item: $item"
}
-
Functions:
-
Define reusable code blocks.
- Example:
function Get-Square {
param([int]$number)
return $number * $number
}
- Working with Files and Directories:
- Get-ChildItem: Lists files and directories.
- Example:
Get-ChildItem -Path C:\
- Example:
- Copy-Item: Copies files or directories.
- Example:
Copy-Item -Path file.txt -Destination C:\Backup\
- Example:
- Remove-Item: Deletes files or directories.
- Example:
Remove-Item -Path file.txt
- Example:
Activities: PowerShell Scripting Basics
60-90 minutes
Explore Basic Cmdlets
15 minutes
- Objective: Get familiar with PowerShell commands.
- Instructions:
- Run
Get-Commandand note different cmdlets. - Use
Get-Helpto learn aboutGet-Service.
Write a Simple Script
20 minutes
- Objective: Create and run a PowerShell script.
- Instructions:
- Write a script that displays system information:
$os = Get-WmiObject -Class Win32_OperatingSystem
Write-Host "Operating System: " $os.Caption
- Save as
SystemInfo.ps1and execute.
Automate a File Backup
30 minutes
- Objective: Use PowerShell to copy files.
- Instructions:
- Write a script that copies all
.docxfiles fromDocumentstoBackupfolder:
$source = "$env:USERPROFILE\Documents\*.docx"
$destination = "$env:USERPROFILE\Backup"
Copy-Item -Path $source -Destination $destination
- Ensure the
Backupfolder exists or create it usingNew-Item.
Use Variables and Loops
15 minutes
- Objective: Practice scripting constructs.
- Instructions:
- Create a script that lists numbers from 1 to 10:
for ($i = 1; $i -le 10; $i++) {
Write-Host "Number: $i"
}
Set Execution Policy
5 minutes
- Objective: Understand and change execution policies.
- Instructions:
- Check current policy:
Get-ExecutionPolicy. - Change policy to allow scripts:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser.
Practical Exercises and Q&A Day 2
Executing Commands and Scripts
Hands-On Practice
- Execute the scripts you have written.
- Experiment with modifying scripts to achieve different outcomes.
Debugging Tips
- Use
Write-HostorWrite-Outputto display variable values. - Check for typos or syntax errors.
- Use
Get-Helpfor assistance with cmdlets.
Closing Questions
- Any questions about any of the topics covered today?
TODO: Provide clarifications and additional examples as needed.
Additional Resources
Articles
- Command Prompt Tutorial by Lifewire.
- PowerShell Scripting Guide by Adam the Automator.
Interactive Tutorials
Key Takeaways
- Networking:
- Understanding how to connect and configure networks is essential for system functionality.
- Regular updates and maintenance keep systems secure and efficient.
- Command-Line Mastery:
- Command-line interfaces provide powerful tools for system management.
- Mastery of basic commands is foundational for advanced IT tasks.
- PowerShell Advantage:
- PowerShell offers enhanced scripting capabilities over CMD.
- Automating tasks saves time and reduces the potential for human error.
- Problem-Solving:
- Using built-in tools to troubleshoot issues enhances system reliability.
- Scripting can solve repetitive problems efficiently.