Recall & Review
beginner
What is the main purpose of log cleanup automation?
To automatically delete or archive old log files to save disk space and keep the system organized.
Click to reveal answer
beginner
In PowerShell, which cmdlet is commonly used to remove files?The <code>Remove-Item</code> cmdlet is used to delete files or folders.Click to reveal answer
intermediate
How can you find files older than 30 days in PowerShell?
Use
Get-ChildItem with Where-Object to filter files by their LastWriteTime property, like: Get-ChildItem | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) }.Click to reveal answer
beginner
Why is it important to test a log cleanup script before scheduling it?
To make sure it deletes only the intended files and does not remove important data by mistake.
Click to reveal answer
beginner
What PowerShell feature allows you to schedule a script to run regularly?
You can use Windows Task Scheduler to run PowerShell scripts on a schedule.
Click to reveal answer
Which PowerShell cmdlet deletes files?
✗ Incorrect
Remove-Item deletes files or folders. The others do not delete files.
How do you select files older than 7 days in PowerShell?
✗ Incorrect
Files older than 7 days have LastWriteTime less than the date 7 days ago.
What is a safe first step before deleting files with a script?
✗ Incorrect
-WhatIf shows what would happen without deleting files, helping avoid mistakes.
Which tool schedules PowerShell scripts to run automatically?
✗ Incorrect
Windows Task Scheduler runs scripts or programs on a set schedule.
What does
Get-ChildItem do in PowerShell?✗ Incorrect
Get-ChildItem lists files and folders, useful for selecting files to delete.
Explain how to create a PowerShell script that deletes log files older than 30 days.
Think about listing, filtering, deleting, and testing steps.
You got /4 concepts.
Describe how to schedule a PowerShell log cleanup script to run every week.
Focus on scheduling steps using Windows tools.
You got /5 concepts.