Hey everyone! I'm looking for some help with automating a PowerShell command. I'm using `Invoke-ADSyncDiagnostics -PasswordSync`, but the script requires me to manually confirm a couple of prompts by pressing 'Y' and 'N'. Since I'm running this as a scheduled task, I'm trying to find a way to automate that input so I don't have to be there to hit those keys. I've attempted to use `Start-Job` with `System.Windows.Forms`, but I think I'm missing something or there's a more straightforward method. Appreciate any advice!
1 Answer
It looks like the script you’re dealing with may have been designed for interactive use only. They included `Read-Host` statements, which suggest they expect user input. Is there a specific reason you need to run this on a schedule? Normally, password sync should happen automatically without needing this command.
You could consider pull out the necessary commands into your own script if most of it is related to interface logic.