Skip to content

Windows Overview

PowerShell


Fundamental Operations in PowerShell

Details

PowerShell Command Mastery: PowerShell is a powerful command-line shell and scripting language for Windows, providing comprehensive control over system functions and automation.

Essential PowerShell Commands:

# Retrieve detailed information about PowerShell commands
Get-Help Get-Process # Displays help information for the 'Get-Process' command

# List all available commands related to a specific noun
Get-Command -Noun Service # Lists all commands that involve services

# List currently running processes
Get-Process | Where-Object {$_.CPU -gt 100} # Lists processes consuming more than 100 CPU units

# Retrieve and filter services based on their status
Get-Service | Where-Object {$_.Status -eq "Running"} # Lists all currently running services

# Change the PowerShell script execution policy
Set-ExecutionPolicy RemoteSigned # Allows scripts downloaded from the internet with a trusted signature to run

# Start or stop a specific service
Start-Service -Name "bits" # Starts the Background Intelligent Transfer Service
Stop-Service -Name "bits" # Stops the Background Intelligent Transfer Service

# Retrieve entries from an event log
Get-EventLog -LogName Application -Newest 50 # Retrieves the 50 most recent entries in the Application log

# Copy and move items
Copy-Item "C:\\source.txt" -Destination "C:\\dest\\" # Copies 'source.txt' to a new location
Move-Item "C:\\temp\\data.txt" -Destination "C:\\archive\\" # Moves 'data.txt' to a new location

# Delete files or directories
Remove-Item "C:\\obsolete.txt" # Deletes 'obsolete.txt'

# Create new files or directories
New-Item -Path "C:\\example.txt" -ItemType File # Creates a new file 'example.txt'

# Check if a file or path exists
Test-Path "C:\\example.txt" # Returns true if 'example.txt' exists

# Reading from and writing to files
Get-Content "C:\\log.txt" # Displays the content of 'log.txt'
Set-Content "C:\\log.txt" -Value "New Log Entry" # Writes 'New Log Entry' to 'log.txt'

# Work with CSV files
Import-Csv "C:\\data.csv" # Imports data from a CSV file into a PowerShell object
Export-Csv -Path "C:\\export.csv" -NoTypeInformation # Exports object data to a CSV file without type information

# Convert data to and from JSON
$processInfo = Get-Process | Select-Object -First 1
$json = $processInfo | ConvertTo-Json # Converts process information to JSON format
$object = $json | ConvertFrom-Json # Converts JSON back to a PowerShell object

# Handling errors with try-catch
try {
    Remove-Item "C:\\important_file.txt" -ErrorAction Stop
} catch {
    Write-Error "Failed to delete important_file.txt"
}

# Managing environment variables
$env:PATH += ";C:\\NewApp\\bin" # Adds a new path to the system PATH environment variable

Find/Filter/Regex

Details

Advanced Filtering and Regex in PowerShell: Utilize PowerShell's powerful capabilities to search, filter, and use regular expressions to manage files and data efficiently.

Finding Specific Files:

# Find large log files throughout the system
Get-ChildItem -Path C:\ -Include *.log -Recurse | Where-Object {$_.Length -gt 1MB}
# Recursively searches for log files larger than 1MB in the C: drive, helping identify large logs that may need attention

# Locate the largest PDF files in user directories
Get-ChildItem -Path "C:\Users\" -Filter "*.pdf" -Recurse | Sort-Object Length -Descending
# Lists all PDF files in user directories, sorted by file size in descending order, to quickly find the largest documents

# Search for files modified in the last 7 days
Get-ChildItem -Path "C:\Data\" -Recurse | Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-7)}
# Finds files in the C:\Data directory that have been modified in the past week

Regex Filtering:

# Search log files for specific patterns
Select-String -Path "C:\Logs\*.log" -Pattern 'Error|Failed'
# Scans all log files in the C:\Logs directory for lines containing 'Error' or 'Failed', useful for troubleshooting

# Extract IP addresses from text files
Select-String -Path "C:\Logs\server.log" -Pattern '\b\d{1,3}(\.\d{1,3}){3}\b'
# Finds and displays lines in 'server.log' that match the pattern of an IP address

# Validate email formats within files
Get-Content "C:\Users\user\emails.txt" | Where-Object {$_ -match '^\S+@\S+\.\S+$'}
# Reads 'emails.txt' and filters for lines that match a basic email address pattern

Advanced File Searches:

# Find files with specific attributes
Get-ChildItem -Path "C:\Work\" -Recurse | Where-Object {$_.Attributes -match 'ReadOnly'}
# Lists files marked as ReadOnly in the C:\Work directory

# Find and display hidden files within a directory
Get-ChildItem -Path "C:\Secrets\" -Hidden | Select-Object Name, Length, LastWriteTime
# Reveals hidden files in the C:\Secrets directory, showing their name, size, and last modified date

# Search for specific text within multiple PDF files (requires additional tools like PDF parsers)
Get-ChildItem -Path "C:\Documents\" -Filter "*.pdf" -Recurse | ForEach-Object {
    $pdfText = Get-Content $_.FullName | Out-String
    if ($pdfText -match 'confidential') {
        $_.FullName
    }
}
# Loops through each PDF file in C:\Documents, extracts text, and checks for the word 'confidential'

Monitoring with PowerShell

Details

Monitoring with PowerShell: Utilize PowerShell to effectively monitor system resources, performance, and security events.

Event Log Monitoring:

# Retrieve and filter event logs
Get-EventLog -LogName Security | Where-Object {$_.EventID -eq 4625}
# Searches the Security log for failed login attempts (Event ID 4625)

# Retrieve specific event logs related to account management
Get-EventLog -LogName Security | Where-Object {$_ -in (4720, 4722, 4725)}
# Monitors for account creation (4720), enabling (4722), and disabling (4725)

# Monitor for changes in group membership
Get-EventLog -LogName Security | Where-Object {$_.EventID -eq 4728}
# Tracks when users are added to security-enabled global groups (Event ID 4728)
# List of critical Event IDs
# 4625: Failed account logon
# 4720: A user account was created
# 4722: A user account was enabled
# 4725: A user account was disabled
# 4728: A member was added to a security-enabled global group
# 4732: A member was added to a security-enabled local group
# 4740: A user account was locked out
# 4771: Kerberos pre-authentication failed
# 4776: The domain controller attempted to validate credentials for an account
# 1102: The audit log was cleared
# 4648: A logon was attempted using explicit credentials
# 4672: Special privileges assigned to new logon
# 4688: A new process has been created
# 4697: A service was installed in the system
# 4698: A scheduled task was created
# 4702: A scheduled task was updated
# 4719: System audit policy was changed
# 4985: The state of a transaction has changed
# 5156: The Windows Filtering Platform has permitted a connection
# 5157: The Windows Filtering Platform has blocked a connection

Performance Monitoring:

# Display system performance
Get-Counter -Counter "\Processor(_Total)\% Processor Time"
# Retrieves the total CPU usage percentage

# Monitor memory usage
Get-Counter -Counter "\Memory\Available MBytes"
# Tracks available memory in MB

# Monitor disk activity
Get-Counter -Counter "\PhysicalDisk(_Total)\Disk Bytes/sec"
# Measures the disk throughput in bytes per second

File System and Network Monitoring:

# Monitor file system changes
Register-ObjectEvent -InputObject (Get-FileSystemWatcher "C:\Logs") -EventName "Changed" -Action {Write-Host "Log file changed"}
# Sets up a file watcher on the C:\Logs directory to alert when any log file is changed

# System uptime
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object LastBootUpTime, LocalDateTime
# Displays system uptime by comparing the last boot-up time with the current local time

# Network statistics
Get-NetAdapterStatistics | Format-Table Name, ReceivedBytes, SentBytes -AutoSize
# Provides detailed statistics on network usage, including bytes received and sent

Commonly Used Commands

Details

Powerful PowerShell Commands for IT Professionals: A collection of essential PowerShell commands designed to streamline daily tasks and system management for IT professionals across various roles.

System Management:

# Manage Windows updates
Get-WindowsUpdate # Fetches and lists all pending Windows updates

# Restart a service
Restart-Service -Name "wuauserv" # Restarts the Windows Update service to apply changes immediately

# Check system performance
Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 5 # Lists the top 5 CPU-consuming processes

Network Management:

# Manipulate network settings
Get-NetIPAddress | Where-Object {$_.AddressFamily -eq "IPv4"} # Lists all IPv4 addresses

# Display network interface configurations
Get-NetAdapter | Select-Object Name, Status, MacAddress, LinkSpeed # Provides detailed information on each network adapter

# Test network connectivity
Test-NetConnection -ComputerName google.com # Checks connectivity to google.com and provides latency information

User and Permissions Management:

# Handle user accounts and permissions
Get-LocalUser | Where-Object {$_.Enabled -eq $true} # Lists all enabled user accounts

# Add a user to a group
Add-LocalGroupMember -Group "Administrators" -Member "NewUser" # Adds 'NewUser' to the 'Administrators' group

# Change file permissions
Get-Acl "C:\path\to\file.txt" | Set-Acl -User "username" -Permissions "FullControl" # Grants 'username' full control over a file

Active Directory Operations:

# Work with Active Directory
Get-ADUser -Filter 'Name -like "*Smith*"' # Finds users in AD with 'Smith' in their names

# Unlock an AD user account
Unlock-ADAccount -Identity "john.doe" # Unlocks the AD account for 'john.doe'

# Set AD user password
Set-ADAccountPassword -Identity "jane.doe" -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "newpassword123!" -Force)

Disk and Storage Management:

# Manage disk storage
Get-Disk | Where-Object {$_.OperationalStatus -eq "Online"} # Lists online disks

# Check disk space usage
Get-PSDrive C | Select-Object Used, Free # Displays used and free space on the C: drive

# Extend a disk partition
Resize-Partition -DriveLetter C -Size 50GB # Extends the C: drive partition to 50GB

Scripting and Automation:

# Schedule a task with PowerShell
$action = New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument '-File "C:\Scripts\BackupScript.ps1"'
$trigger = New-ScheduledTaskTrigger -At 3am -Daily
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "DailyBackup" # Creates a daily task to run a backup script

# Read and filter event logs
Get-EventLog -LogName Application | Where-Object {$_.EntryType -eq "Error"} | Select-Object TimeGenerated, Message # Filters and displays error messages from the Application log

# Monitor file changes
Register-ObjectEvent -InputObject (Get-FileSystemWatcher -Path "C:\Data") -EventName "Changed" -Action { Write-Host "Data changed at $($_.TimeGenerated)" }

PowerShell Scripting

Details

Advanced Scripting Techniques: Elevate your PowerShell scripts with advanced features and best practices for robust, efficient automation.

Error Handling in Scripts:

# Robust error handling in PowerShell
try {
    Remove-Item "C:\importantfile.txt" -ErrorAction Stop
} catch {
    Write-Error "Failed to remove file: $_"
} finally {
    Write-Output "Operation attempted on C:\importantfile.txt"
}
# This structure ensures that errors are caught and handled, and the 'finally' block executes code regardless of the result.

Automating User Creation:

# Bulk add users to Active Directory from a CSV file
Import-Csv "C:\users.csv" | ForEach-Object {
    New-ADUser -Name $_.Name -GivenName $_.FirstName -Surname $_.LastName -Enabled $True -PasswordNeverExpires $True -AccountPassword (ConvertTo-SecureString -AsPlainText "P@ssw0rd" -Force)
}
# This script reads user data from a CSV and creates AD user accounts with specified attributes.

Task Scheduling:

# Schedule a PowerShell script to run daily
$action = New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument '-File "C:\Script.ps1"'
$trigger = New-ScheduledTaskTrigger -At 7am -Daily
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "DailyScriptRun"
# This command sets up a scheduled task to run a script every day at 7 AM.

Advanced Scripting Scenarios:

# Monitor and restart a service if it stops
$serviceName = "MyService"
$service = Get-Service -Name $serviceName
if ($service.Status -ne 'Running') {
    Start-Service $serviceName
    Write-Host "$serviceName started."
}
# This script checks if a specific service is running and starts it if it's not.

# Cleanup old files in a directory
$path = "C:\OldFiles"
Get-ChildItem -Path $path -File | Where-Object { $_.CreationTime -lt (Get-Date).AddDays(-30) } | Remove-Item -Force
# This script deletes files created more than 30 days ago from a specific directory.

# Manage firewall rules
$ruleName = "AllowSSH"
if (!(Get-NetFirewallRule -Name $ruleName)) {
    New-NetFirewallRule -DisplayName $ruleName -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow
}
# This script checks for the existence of a firewall rule and creates it if it doesn't exist.

# Parsing log files for specific entries
Get-Content "C:\Logs\server.log" | Select-String -Pattern "ERROR" | ForEach-Object {
    Write-Host "Error found: $_"
}
# This script reads a log file and outputs lines containing "ERROR".

# Dynamic DNS updates via script
$ipAddress = (Invoke-RestMethod http://ipinfo.io/json).ip
$dnsZone = "mydomain.com"
$dnsRecord = "host.mydomain.com"
Add-DnsServerResourceRecordA -Name $dnsRecord -ZoneName $dnsZone -IPv4Address $ipAddress -TimeToLive 3600
# Updates a DNS A record with the public IP address of the machine running the script.

Networking


IP Configuration

Details

IP Address Configuration: Effective management of IP addresses is crucial for ensuring proper network communication and connectivity in Windows environments.

Viewing IP Configuration:

# View all network configuration details using Command Prompt
ipconfig /all
# This command displays detailed information about all network interfaces, including IP address, subnet mask, and default gateway.

Setting Static IP via GUI:

  • Navigate to Control Panel > Network and Sharing Center > Change adapter settings.
  • Right-click on the network connection you want to configure (e.g., Ethernet, Wi-Fi), and select Properties.
  • Double-click 'Internet Protocol Version 4 (TCP/IPv4)' or 'Internet Protocol Version 6 (TCP/IPv6)' depending on your network configuration.
  • Select 'Use the following IP address' and enter the IP address, Subnet mask, and Default gateway. Optionally, specify the Preferred and Alternate DNS server addresses.
  • Click OK to apply the settings.

Setting Static IP via PowerShell:

# Configure a static IP address using PowerShell
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.1.100 -PrefixLength 24 -DefaultGateway 192.168.1.1
# Assigns a static IP address to the 'Ethernet' interface, with subnet mask (prefix length of 24) and a default gateway.

Configuring DNS via GUI:

  • Follow the same steps to navigate to the Properties of your network connection as described for setting a static IP.
  • Select 'Internet Protocol Version 4 (TCP/IPv4)' or 'Internet Protocol Version 6 (TCP/IPv6)', then click Properties.
  • Choose 'Use the following DNS server addresses' and input the Preferred DNS server and Alternate DNS server.
  • Click OK to save the DNS settings.

Configuring DNS via PowerShell:

# Set DNS servers for an interface using PowerShell
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses "8.8.8.8", "8.8.4.4"
# Configures Google DNS (8.8.8.8 and 8.8.4.4) for the 'Ethernet' network interface, enhancing DNS resolution.

Advanced IP Management Commands:

# Release and renew DHCP IP address
ipconfig /release
ipconfig /renew
# These commands are useful for resolving IP address conflicts or after changes in DHCP settings.

# Flush DNS to clear the DNS resolver cache
ipconfig /flushdns
# Useful for troubleshooting DNS problems, ensuring that your computer's DNS queries are not using outdated or incorrect information.

# Display the routing table
Get-NetRoute | Format-Table -AutoSize
# Displays the IP routing table which is helpful for troubleshooting routing issues.

Firewall Configuration

Details

Managing Windows Firewall: Optimize your network security by effectively managing the rules and monitoring activities of Windows Firewall through both the GUI and PowerShell commands.

Accessing Firewall Settings via GUI:

  • Navigate to Control Panel > System and Security > Windows Defender Firewall > Advanced Settings. This opens the Windows Firewall with Advanced Security GUI, where you can manage all settings.
  • To access the firewall directly, you can also type wf.msc into the Run dialog box (Win+R).

Configuring Rules via GUI:

  • From the main firewall window, select either 'Inbound Rules' or 'Outbound Rules' from the left pane depending on your needs.
  • Click on 'New Rule' on the right pane to start the rule wizard. This wizard helps you to create rules based on programs, ports, predefined rules, or custom settings.
  • Follow the wizard to define the rule properties, specify which ports or programs the rule applies to, and choose the action (Allow or Block).

Configuring Rules via PowerShell:

# Create an inbound rule to allow ICMP (ping) requests
New-NetFirewallRule -DisplayName "Allow ICMP" -Direction Inbound -Protocol ICMPv4 -Action Allow

# Block a specific application
New-NetFirewallRule -DisplayName "Block Program" -Direction Outbound -Program "C:\Program Files\App\app.exe" -Action Block

# Allow traffic on a specific port
New-NetFirewallRule -DisplayName "Allow Port 8080" -Direction Inbound -LocalPort 8080 -Protocol TCP -Action Allow

Monitoring Firewall via GUI:

  • In the Windows Firewall with Advanced Security GUI, navigate to the 'Monitoring' section. This area displays all currently active firewall rules along with their details such as profiles, enabled status, and action.
  • This section also shows the active connections being managed by the firewall, providing a comprehensive view of network security enforcement.

Monitoring Firewall via PowerShell:

# List all active firewall rules
Get-NetFirewallRule | Where-Object {$_.Enabled -eq $true} | Format-Table Name, DisplayName, Direction, Action -AutoSize

# Get details of specific firewall rules
Get-NetFirewallRule -DisplayName "Allow ICMP" | Format-List *

# Monitor network traffic filtered by firewall rules
Get-NetFirewallProfile -Profile Domain, Private, Public | Format-Table Name, Enabled, DefaultInboundAction, DefaultOutboundAction

Advanced Network Security Settings:

# Enable logging of dropped packets
Set-NetFirewallProfile -Profile Domain,Private,Public -LogFileName "%systemroot%\System32\LogFiles\Firewall\pfirewall.log" -LogDroppedPackets $true

# Configure firewall for stealth mode
Set-NetFirewallProfile -Profile Domain,Private,Public -DisableStealthMode $false

Network Troubleshooting

Details

Essential Network Diagnostics Tools: A suite of tools for testing connectivity, tracing routes, and inspecting network configurations to troubleshoot and optimize network performance.

Basic Network Troubleshooting Commands:

# Ping to test connectivity
ping www.google.com # Checks if Google's servers are reachable and measures round-trip time

# Traceroute to trace packet paths
tracert www.google.com # Traces the route packets take to Google and identifies where delays occur

# View network connections and statistics
netstat -an # Displays all network connections and listening ports numerically

# Test connectivity to a TCP port using Telnet
telnet example.com 80 # Tests if the HTTP port (80) is open on example.com

# Detailed network diagnostics with PowerShell
Test-NetConnection www.google.com -TraceRoute # Performs a traceroute to Google and checks connectivity
Test-NetConnection www.google.com -Port 443 # Tests connectivity to the HTTPS port (443)

Advanced Network Diagnostics:

# DNS lookup using Nslookup
nslookup google.com # Retrieves DNS details for google.com, including IP addresses

# PathPing for detailed route tracing
pathping www.google.com # Combines ping and traceroute to show packet loss at each hop to Google

# Manipulate network configurations with Netsh
netsh interface show interface # Lists all network interfaces on the machine

# Use Nmap for network exploration and security auditing
nmap -v -A example.com # Performs a network scan on example.com, showing open ports and detecting services

# Wireshark for packet analysis
# Note: Wireshark needs to be run with GUI
# Captures and analyzes network packets, providing detailed information about network traffic

# TCPView to monitor network connections dynamically
# Note: TCPView is part of Sysinternals Suite and provides a detailed overview of all TCP and UDP endpoints

Network Shell Enhancements:

# Adjust network configurations dynamically
netsh wlan show profiles # Lists all wireless network profiles saved on the computer

# Advanced firewall configuration
netsh advfirewall set allprofiles state on # Turns on the firewall for all profiles

# Diagnose and repair network issues with built-in troubleshooter
msdt.exe /id NetworkDiagnosticsWeb # Runs diagnostics for web-related connectivity issues

# Additional Network Diagnostics Tools
# Use ipconfig to view and renew IP address configurations
ipconfig /all # Displays detailed information about all network interfaces
ipconfig /renew # Renews DHCP configuration for all adapters

System Operations


Event Viewer Logs & Monitoring

Details

Event Viewer: A vital tool in Windows for logging and analyzing system events, offering detailed insights into system operations, security events, and potential errors. It serves as a fundamental resource for troubleshooting and monitoring system health.

Access through GUI: - Navigate to Control Panel > Administrative Tools > Event Viewer. This opens the Event Viewer, where you can view and manage various types of system and application logs.

  • Alternatively, press Win + R and type eventvwr.msc to launch Event Viewer directly.

Understanding Event Logs:

  • Application Logs: These logs contain events logged by applications or programs. For example, a database program might record a file error in the application log. Administrators can use this information to identify and resolve issues with software.
  • Security Logs: These logs store security-related events specified by the system's audit policy, such as valid and invalid login attempts, as well as any resource access made by users. This log is crucial for compliance tracking and security incident investigation.
  • System Logs: These logs contain events logged by the operating system components, such as the failure of a driver or a service. It can be useful for diagnosing hardware and software problems.

Navigating and Analyzing Events in GUI:

  • Filtering Logs:
    • Navigate to the Security log from the left pane.
    • Right-click on Security and select Filter Current Log.
    • In the filter window, you can specify certain criteria such as Event IDs. For example, enter 4625 to filter for failed login attempts, or 4738 for account modifications.
    • Click OK to apply the filter and view the filtered events.
  • Custom Views:
    • For frequent analysis, create custom views by right-clicking Custom Views and selecting Create Custom View.
    • Specify the criteria, including the log to query, event levels, and date ranges. This allows for quick access to logs of interest in future sessions.
  • Attaching Tasks to Events:
    • Right-click an event and select Attach Task To This Event.
    • Follow the wizard to set up a task that triggers on the occurrence of this event, such as sending an email notification or executing a program.

Event Viewer Tips:

  • Saving Logs: To save logs for documentation or external analysis, right-click any log in the left pane, select Save All Events As, and choose the file format and location.
  • Clearing Logs:
    • To clear a log (after saving necessary events for backup), right-click on the log and select Clear Log. This can help with managing space and ensuring that Event Viewer runs efficiently.
  • Accessing Event Properties:
    • Double-click an event to open its properties window, which provides detailed information about the event, including the event ID, source, and description. This can be invaluable for troubleshooting specific issues.

Using PowerShell to Retrieve Logs:

  • General Retrieval: Use Get-EventLog to extract and query logs. Example: Get-EventLog -LogName Security -Newest 50 retrieves the 50 most recent entries from the Security log.
  • Filtering by Event ID: Tailor your queries to specific needs. Example: Get-EventLog -LogName System -InstanceId 1074 fetches logs associated with system shutdowns.
  • Complex Queries: Combine conditions to refine searches. Example: Get-WinEvent -FilterHashtable @{LogName='Application'; Level=2; StartTime=(Get-Date).AddDays(-1)} gets all critical application events from the past day.

Performance and Resource Monitor

Details

Performance and Resource Monitor: Essential Windows tools that provide comprehensive insights into system performance and resource usage, allowing for detailed monitoring and troubleshooting of various system components.

Accessing the Tools:

  • Performance Monitor: Open Performance Monitor by typing perfmon into the Start menu search. This tool is designed for long-term monitoring and can track a variety of system metrics over time.
  • Resource Monitor: Access Resource Monitor by typing resmon into the Start menu search. It provides real-time data on system resource usage, including CPU, memory, disk, and network activities.

Using Performance Monitor:

  • Data Collector Sets:
    • Navigate to Performance Monitor > Data Collector Sets in the left pane to configure and use data collector sets.
    • Create custom sets to gather performance data over specific intervals, selecting counters that target areas of interest such as CPU, disk I/O, or memory usage.
  • Adding Performance Counters:
    • In the main Performance Monitor window, click on the + button to add new counters.
    • Select counters such as % Processor Time under the Processor category to monitor CPU usage or Available MBytes under the Memory category for memory tracking.

Using Resource Monitor:

  • Overview Tab:
    • Provides a snapshot of current system resource usage, displaying active processes and their impact on CPU, memory, disk, and network.
    • Useful for quick assessments and initial diagnostics.
  • Detailed Monitoring:
    • Switch to the CPU, Memory, Disk, and Network tabs for more detailed views.
    • Observe specific processes and resources, and manage process priorities or end tasks directly from the interface.
    • Analyze which files or network connections are being accessed by specific processes, helping in detailed troubleshooting.

GUI Interaction and Features:

  • Ending Processes and Services:
    • Both monitors allow you to right-click on any process to end it or modify its priority, providing direct control over running applications.
  • Exporting Data:
    • Data from both Performance Monitor and Resource Monitor can be saved for further analysis or reporting. In Performance Monitor, use the Save Data option; in Resource Monitor, use the File > Save As menu.

Tips for Effective Monitoring:

  • Regularly review both performance and resource monitors to understand your system's baseline performance.
  • Use alerts in Performance Monitor to automatically notify you when specific thresholds are exceeded, enabling proactive management of potential issues.
  • Combine findings from both tools for a comprehensive view of system health, especially when diagnosing complex performance issues or planning system enhancements.

System Management Tools

Details

Overview: Windows provides several powerful tools to monitor and manage system resources, services, and registry settings, each playing a crucial role in system administration and optimization.

Antivirus Protection:

  • Windows Defender: Automatically included with Windows, Defender offers comprehensive protection against malware and spyware. Access Defender settings through the Windows Security app to customize scanning options and update security definitions.
  • Enhancements with Third-Party Antivirus: While Windows Defender provides solid protection, additional features from third-party software like Norton or McAfee can offer further security layers. These typically include enhanced firewall options, phishing protection, and more detailed security reports.
  • Installing Third-Party Antivirus: Choose a reputable antivirus provider and follow their installation procedures to enhance your system's security. Ensure that Windows Defender is disabled appropriately to prevent conflicts if another antivirus is in use.

Task Manager:

  • Accessing Task Manager: Quickly open Task Manager by pressing Ctrl+Shift+Esc or right-clicking the taskbar and selecting "Task Manager."
  • Performance Tab: Offers real-time insights into CPU, memory, disk, and network utilization, crucial for diagnosing performance issues and understanding resource allocation. Use the CPU history graph to identify spikes in usage.
  • Processes Tab: Lists all running processes with the ability to end non-responsive tasks, change process priorities, or investigate each process's resource usage. This is particularly useful for managing applications that are not responding or are using excessive resources.

Services:

  • Using the Services Console: Open services.msc through the Run dialog (Win+R) to manage all Windows services. This console allows users to start, stop, pause, or resume services, and adjust their settings for optimized performance.
  • Service States and Configuration: Navigate to any service, right-click, select 'Properties', then adjust its startup type and recovery options under the 'Recovery' tab. For example, setting 'First failure' to 'Restart the Service' ensures reliability and uptime for critical services.
  • Optimizing Service Performance: Determine the appropriate startup type for each service (Automatic, Manual, or Disabled) to enhance system boot times and overall performance.

Registry Editor:

  • Accessing Registry Editor: Launch the Registry Editor by typing regedit in the Run dialog (Win+R). This tool provides access to all system and application settings stored within the Windows registry.
  • Navigating Registry Hives: To modify system settings, navigate through the registry hives. For instance, to change desktop wallpaper settings, go to HKEY_CURRENT_USER\Control Panel\Desktop and modify the Wallpaper string value.
  • Modifying Registry Safely: Always back up the registry before making changes to avoid potential system issues. Right-click on any registry key, select 'Export', and save the backup file. When modifying settings, such as TCP/IP parameters at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters, understand the implications to ensure system stability.

Practical Tips:

  • Resource Management: Use Task Manager to monitor application impacts on system performance and end tasks that cause system instability or slowdowns.
  • Service Management: Regularly review service configurations to ensure they align with current system use and security standards, especially after software updates or system changes.
  • Registry Tweaks: Exercise caution when modifying the registry. Small changes can have broad impacts, so only make changes that you understand fully and have researched beforehand.

User Management and Permissions

Details

Overview: Managing user accounts and permissions is crucial for securing access to system resources and data. This section covers the creation and management of users and groups, and the configuration of file and folder permissions.

Managing Local Users and Groups:

  • User Accounts:
    • Creating and Managing Local Users via Command Line:
      net user username password /add # Adds a new user with specified username and password
      net user username newpassword # Resets the user's password
      
    • Modifying User Accounts:
      net user username /active:yes # Activates the user account
      net user username /expires:never # Ensures the user account does not expire
      
  • User Groups:
    • Group Management via Command Line:
      net localgroup Administrators username /add # Adds a user to the 'Administrators' group
      net localgroup "Remote Desktop Users" username /add # Adds a user to enable remote desktop access
      
    • Managing Built-in and Custom Groups:
      net localgroup "CustomGroup" /create # Creates a new custom group
      net localgroup "CustomGroup" username /add # Adds a user to the newly created custom group
      

Setting and Managing Permissions:

  • File and Folder Permissions:
    • Accessing ACLs via GUI:
      • Navigate to any file or folder, right-click, select 'Properties', then go to the 'Security' tab.
      • Click 'Edit' to modify permissions or 'Add' to include new users or groups. Set the desired permissions (Full control, Modify, Read, etc.) for each user or group.
    • Command Line Management with Icacls:
      icacls filename /grant username:(F) # Grants full access rights to a user
      icacls filename /remove:g username # Removes specified user's access rights
      
  • Configuring Shared Folder Permissions:
    • Sharing Folders via GUI:
      • Right-click on a folder, choose 'Give access to', then 'Specific people'.
      • Add users or groups and specify their permission level (Read, Read & Write).
    • Understanding Network vs. NTFS Permissions:
      • Share Permissions: Set when a folder is shared and determines who can access the folder over the network.
      • NTFS Permissions: Set on the 'Security' tab of the folder's properties, controlling what actions users can perform on folder contents.

Best Practices:

  • Always back up important data before making significant changes to user accounts or permissions.
  • Use the principle of least privilege by assigning users the minimum permissions necessary for their roles.
  • Regularly review and update permissions to ensure they align with current user roles and organizational policies.

Task Scheduler

Details

Task Scheduler: A powerful Windows tool that automates tasks based on predefined times or specific system events. It is essential for automating regular system maintenance, running scripts, or starting programs without manual intervention.

Accessing Task Scheduler via GUI:

  • Navigate to Control Panel > Administrative Tools > Task Scheduler.
  • Alternatively, type taskschd.msc in the Run dialog (Win+R) to launch Task Scheduler directly.

Creating and Configuring Tasks:

  • Creating a New Task:
    • In the Task Scheduler, go to the Action menu and select Create Basic Task for simple tasks or Create Task for more advanced settings.
    • Follow the wizard to name and describe your task.
  • Configuring Triggers:
    • In the task creation wizard, select the Triggers tab.
    • Click New to set up a trigger. Common triggers include:
      • Daily: Schedule tasks to run daily at a specific time, e.g., a backup task every night at 2 AM.
      • At startup: Run tasks every time the system starts.
      • On an event: Trigger tasks based on system events, such as when a specific event log entry is made.
    • Example: To set a daily trigger, choose the Daily option, set the start time, and configure any advanced settings like recurring days.
  • Defining Actions:
    • Move to the Actions tab and click New.
    • Choose the action type, such as Start a program or Send an email.
    • If running a script, browse and select the script file, e.g., C:\Scripts\backup.ps1.
    • Example: Configure an action to start an application or script like running a PowerShell script backup.ps1 when the trigger conditions are met.

Example Use Cases:

  • Automate Disk Cleanup:
    • Trigger: Weekly on Saturdays at 3 AM.
    • Action: Start program cleanmgr.exe with arguments to clean up system files automatically.
  • Send Email Notifications:
    • Trigger: On workstation lock or unlock.
    • Action: Use a script to send an email notification detailing the security event.

Managing Tasks:

  • View Existing Tasks: Browse the Task Scheduler Library to see all configured tasks. You can right-click any task to run, end, disable, or delete it.
  • Edit Tasks: Double-click a task to open its properties. From here, you can modify the triggers, actions, conditions, and settings.

Basic Script via PowerShell:

# PowerShell script to create a scheduled task
$action = New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument '-File "C:\\Scripts\\dailyReport.ps1"'
$trigger = New-ScheduledTaskTrigger -Daily -At 7am
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Daily Report" -Description "Generates a daily report at 7 AM."

Tips for Effective Task Management:

  • Review and Test: Regularly review scheduled tasks to ensure they are running as expected. Test new tasks immediately after setting them up to confirm they work correctly.
  • Use Descriptive Names: Always use clear, descriptive names for tasks to easily identify their purpose later.
  • Monitor Task History: Check the history tab for each task to troubleshoot failed tasks or confirm successful executions.

General Knowledge


Web Servers

Details

IIS: Microsoft's Internet Information Services (IIS) is a flexible, secure, and manageable web server for hosting websites, applications, and services on Windows.

  • Website Configuration: Use IIS Manager to configure websites, set up virtual directories, and manage application pools to optimize resource usage. For example, to host a new website, open IIS Manager, right-click on 'Sites', choose 'Add Website', and specify the directory and domain name.
  • Security Features: IIS includes built-in security features such as SSL/TLS support for encrypted connections, request filtering to block harmful requests, and IP security to restrict or allow access based on IP addresses.
    • Configuring SSL/TLS: In IIS Manager, select your site, open 'SSL Settings', and check 'Require SSL' to enforce secure connections.

Apache HTTP Server: The Apache HTTP Server is one of the most widely used web servers in the world, known for its flexibility and customization through extensive configuration options.

  • Configuration Files: Apache's behavior is controlled by directives in configuration files like httpd.conf. Users can edit this file to set up virtual hosts, which allow multiple websites to run on a single server. Example: To enable mod_rewrite for clean URLs, add LoadModule rewrite_module modules/mod_rewrite.so to httpd.conf.
  • Modules: Extend Apache's functionality by enabling modules for different features. For example, enable the SSL module for secure connections by adding LoadModule ssl_module modules/mod_ssl.so to httpd.conf and configuring a virtual host for SSL.

NGINX: Known for its high performance and low resource consumption, NGINX is ideal for serving static content, as a reverse proxy, and for load balancing.

  • Configuration Directives: NGINX is configured through the nginx.conf file. Users can define 'server' blocks to set up virtual hosts and use 'location' blocks to handle specific URLs or paths within a site. Example: Configure a server block for a domain with root document directory and specific listen directives.
    server {
        listen 80;
        server_name example.com;
        location / {
            root /var/www/html;
            index index.html index.htm;
        }
    }
    
  • Reverse Proxy Configuration: Use NGINX as a reverse proxy to distribute client requests to backend servers, enhancing application scalability and reliability. Example:
    server {
        location /app/ {
            proxy_pass http://backendserver:8080;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
    

Databases

Details

SQL Server: A robust relational database management system by Microsoft, designed for enterprise-level data storage, management, and retrieval.

  • Installation and Configuration: SQL Server can be installed via the SQL Server setup wizard, which guides users through the process. After installation, configure instances using SQL Server Configuration Manager.
  • Database Management: SQL Server Management Studio (SSMS) provides a comprehensive environment for managing databases, executing queries, and configuring server settings.
    • GUI Methods: Use SSMS to create databases, execute T-SQL scripts, and manage user permissions. For example, to create a new database, right-click on 'Databases', select 'New Database', and follow the prompts.
    • Command Line: Manage SQL Server from the command line using sqlcmd. Example: sqlcmd -S .\SQLEXPRESS -Q "CREATE DATABASE SampleDB"
  • Security Features: Implements robust security measures including authentication modes (Windows and SQL Server authentication), role-based access control, and data encryption.
    • Configuring Security: Set up roles and permissions within SSMS or use T-SQL commands like CREATE USER and GRANT to define access levels. Implement Transparent Data Encryption (TDE) to encrypt data at rest.

MySQL: An open-source relational database management system, popular for web-based applications and used by global enterprises.

  • Installation and Setup: MySQL can be installed on Windows using the MySQL Installer, which also configures initial settings and components.
  • Database Administration: MySQL Workbench provides a visual interface for database management, SQL development, and server configuration.
    • GUI Methods: MySQL Workbench allows users to design databases, execute queries, and manage security settings. To add a new user, navigate to 'Server' > 'Users and Privileges' and click 'Add Account'.
    • Command Line: Utilize the MySQL shell or command line client to manage databases. Example: mysql -u root -p -e "CREATE DATABASE newdb"
  • Security Features: Includes features like SSL/TLS encryption, role-based access control, and audit logging to enhance database security.
    • Security Configuration: Configure user roles and permissions through MySQL Workbench or by executing SQL statements like GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost' IDENTIFIED BY 'password'; to ensure robust access control.

Backup Tools

Details

File History: File History is a built-in backup tool in Windows that automatically backs up files and folders to an external drive or network location. Users can configure backup settings, restore previous versions of files, and recover data using the File History feature.

Backup and Restore: The Backup and Restore tool in Windows allows users to create system image backups, restore system files, and recover data from backups. Users can schedule regular backups, create backup sets, and manage backup storage locations using this utility.

System Restore: System Restore is a Windows feature that creates restore points to capture system settings and configurations at specific points in time. Users can use System Restore to revert the system to a previous state, undo system changes, and recover from system errors or crashes.

Restore Points: Restore points are snapshots of the system state that include registry settings, system files, and installed applications. Users can create manual restore points or rely on automatic restore points created by Windows before system changes or software installations.

Recovery Environment: Windows Recovery Environment (WinRE) is a troubleshooting tool that provides recovery options for repairing system files, restoring system images, and recovering from system failures. Users can access WinRE through the Advanced Startup Options menu or by booting from a recovery drive.

System Image Recovery: System Image Recovery allows users to restore the system from a previously created system image backup. Users can boot into WinRE, select a system image, and restore the system to its original state using this recovery option.

Virtualization

Details
  • Hyper-V: Hyper-V is a native hypervisor in Windows that enables users to create and manage virtual machines on Windows systems. Users can run multiple operating systems simultaneously, isolate applications, and test software configurations using Hyper-V virtualization technology.
  • Virtual Machines: Virtual machines in Hyper-V are isolated environments that run on a host system, each with its own operating system, applications, and resources. Users can create, configure, and manage virtual machines using the Hyper-V Manager console.
  • Integration Services: Integration Services in Hyper-V enhance the performance and functionality of virtual machines by providing drivers, services, and utilities for guest operating systems. Users can install Integration Services to enable features like time synchronization, mouse integration, and network connectivity in virtual machines.

  • VirtualBox: VirtualBox is a free and open-source virtualization software that allows users to create and run virtual machines on Windows, macOS, and Linux systems. Users can install multiple guest operating systems, configure virtual networks, and test software applications using VirtualBox.

  • Guest Additions: Guest Additions in VirtualBox are software packages that enhance the performance and usability of virtual machines. Users can install Guest Additions to enable features like shared folders, seamless mode, and accelerated graphics in guest operating systems.
  • Virtual Machine Settings: VirtualBox provides a range of settings to configure virtual machines, including hardware specifications, network settings, and storage options. Users can customize virtual machine settings to optimize performance, allocate resources, and manage virtual machine behavior.