PowerShell - Scripting Best Practices
You have this function:
When running
function Remove-Log {
param($File)
if ($PSCmdlet.ShouldProcess($File)) {
Remove-Item $File
}
}When running
Remove-Log -File 'log.txt' -WhatIf, it throws an error. What is the likely cause?