true if the current file hash matches the baseline, indicating no drift?$baselineHash = 'ABC123' $currentHash = Get-FileHash -Path 'C:\config.txt' -Algorithm SHA256 | Select-Object -ExpandProperty Hash
Option D uses the -eq operator to check if the current hash equals the baseline hash, returning true if they match, meaning no drift.
Option D calls a method that works but returns a boolean, but in PowerShell, -eq is preferred for clarity.
Option D checks for inequality, which is the opposite of what is needed.
Option D returns a comparison object, not a boolean.
C:\config.txt into a variable $configContent for drift analysis?Option A uses Get-Content with -Raw to read the entire file as one string, ideal for drift checks.
Option A and D use non-existent cmdlets.
Option A reads content line by line and converts to string, but may add unwanted newlines.
DetectDrift.ps1 daily at 2 AM to check configuration drift. Which command correctly creates this scheduled task?Option A correctly uses Register-ScheduledTask with a daily trigger at 2 AM and an action to run PowerShell with the script.
Option A uses a non-existent cmdlet.
Option A is a valid schtasks command but is not PowerShell native cmdlet.
Option A uses a non-existent cmdlet and parameters.
$baselineHash = 'ABC123'
$currentHash = Get-FileHash -Path 'C:\config.txt' -Algorithm SHA256
if ($currentHash -eq $baselineHash) { Write-Output 'No drift' } else { Write-Output 'Drift detected' }$currentHash is an object with properties, not just the hash string. Comparing it directly to a string will fail.
The correct approach is to compare $currentHash.Hash to $baselineHash.
Configuration drift detection focuses on finding differences from a known good baseline to keep systems consistent.
Options A, B, and C describe other tasks not directly related to drift detection.