I have a script that sends monthly AD reports as an SMTP attachment. I've specified the username, and the password is stored locally in a text file on my desktop, but a Credentials box still pops up. The script works perfectly as long as I provide the username/password in the credential box.
Separate question – I want add the date to the Subject line using . I thought I could do $date = (Get-Date).AddDays(-1).ToString('MM-dd-yyyy'), and pass $date into the subject line, but that isn't working. Any suggestions?