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

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:
    1. Access Network Icon: Click on the Network icon in the system tray (usually found at the bottom-right corner).
    2. Select Network: A list of available Wi-Fi networks will appear. Choose the desired network.
    3. Enter Password: If the network is secured, you will be prompted to enter a password.
    4. Connect Automatically: Optionally, check the box to connect automatically when the network is in range.
    5. Connect: Click Connect to establish the connection.
  • Connecting to a Wired Network:
  • Steps:
    1. Plug in Ethernet Cable: Connect one end to your computer's Ethernet port and the other to a router or modem.
    2. 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

  1. Connect to a Wi-Fi Network (15 minutes):
  2. Objective: Practice connecting to a wireless network.
  3. Instructions:
    • Use the network icon to find and connect to a Wi-Fi network.
    • Enter the password if required.
    • Toggle the Connect automatically option.
  4. Set a Static IP Address (20 minutes):
  5. Objective: Learn to manually configure IP settings.
  6. 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.
  7. Change Network Profile (10 minutes):
  8. Objective: Understand the impact of network profiles.
  9. Instructions:
    • Switch between Public and Private profiles.
    • Observe changes in network discovery and sharing settings.
  10. Network Troubleshooting (15 minutes):
  11. Objective: Use built-in tools to diagnose issues.
  12. 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

  1. Run Windows Update (15 minutes):
  2. Objective: Ensure your system is up to date.
  3. Instructions:
    • Check for updates and install any available.
    • Set active hours to prevent unexpected restarts.
  4. Use Troubleshooters (15 minutes):
  5. Objective: Resolve common issues.
  6. Instructions:
    • Simulate a problem, such as disabling a device.
    • Run the appropriate troubleshooter to fix it.
  7. Explore Event Viewer (10 minutes):
  8. Objective: Learn to read system logs.
  9. Instructions:
    • Open Event Viewer and navigate through different logs.
    • Identify any errors or warnings and discuss possible causes.
  10. Perform Disk Cleanup (10 minutes):
  11. Objective: Free up disk space.
  12. Instructions:
    • Run Disk Cleanup and select files to delete.
    • Note the amount of space recovered.
  13. Monitor System Performance (10 minutes):
  14. Objective: Use Task Manager to understand resource usage.
  15. 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.
  • 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
  • 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)
  • cls: Clears the command prompt screen.
  • echo: Displays messages.
    • Example: echo Hello World

Basic CMD Commands

File and Directory Operations

  • Creating a Directory:

  • mkdir [directory_name] or md [directory_name]

    • Example: mkdir Projects
  • Deleting a Directory:

  • rmdir [directory_name] or rd [directory_name]

    • To delete a directory and its contents: rmdir /s [directory_name]
  • 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
  • Copying Files:

  • copy [source] [destination]

    • Example: copy file.txt D:\Backup\
  • Moving/Renaming Files:

  • move [source] [destination]

    • Example: move file.txt D:\Documents\
  • Viewing File Content:

  • type [filename]
    • Example: type notes.txt

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%
  • 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

  1. Navigate Directories (15 minutes):
  2. Objective: Practice moving around the file system.
  3. Instructions:
    • Use cd to navigate to different directories.
    • Use dir to list contents.
  4. Manage Files and Folders (20 minutes):
  5. Objective: Create and manipulate files and directories.
  6. 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.
  7. Use Environment Variables (15 minutes):
  8. Objective: Utilize system variables in commands.
  9. Instructions:
    • Navigate to your desktop using: cd %USERPROFILE%\Desktop.
    • Display the PATH variable: echo %PATH%.
  10. Explore Help Commands (10 minutes):
  11. Objective: Learn to get help on commands.
  12. Instructions:
    • Use help to list available commands.
    • Use help [command] for details on a specific command.
    • Example: help dir

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
  • 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 .ps1 extension.

  • 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
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:\
  • Copy-Item: Copies files or directories.
    • Example: Copy-Item -Path file.txt -Destination C:\Backup\
  • Remove-Item: Deletes files or directories.
    • Example: Remove-Item -Path file.txt

Activities: PowerShell Scripting Basics

60-90 minutes

Explore Basic Cmdlets

15 minutes

  • Objective: Get familiar with PowerShell commands.
  • Instructions:
  • Run Get-Command and note different cmdlets.
  • Use Get-Help to learn about Get-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.ps1 and execute.
Automate a File Backup

30 minutes

  • Objective: Use PowerShell to copy files.
  • Instructions:
  • Write a script that copies all .docx files from Documents to Backup folder:
$source = "$env:USERPROFILE\Documents\*.docx"
$destination = "$env:USERPROFILE\Backup"
Copy-Item -Path $source -Destination $destination
  • Ensure the Backup folder exists or create it using New-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-Host or Write-Output to display variable values.
  • Check for typos or syntax errors.
  • Use Get-Help for assistance with cmdlets.

Closing Questions

  • Any questions about any of the topics covered today?

TODO: Provide clarifications and additional examples as needed.

Additional Resources

Resources Day 2

Articles

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.