I’m trying to set up a scheduled task that runs a powershell command to disable a domain account on a given day.
I don’t understand why this works
$name = "test user" Disable-ADAccount -Identity $name
And this does not?
$name = "test user" powershell -NoProfile -WindowStyle Hidden -command {Disable-ADAccount -Identity $name}
Error: ‘Cannot validate argument on parameter ‘Identity’. The argument is null.’