Contact & Subscribe RSS

LinkedIn
RSS

PowerShell: The specified string is not in the form required for a subject

During the creation of a PowerShell SMA Runbook I was getting the following error message. This error appear when sending an automatic mail message with the send-mailmessage cmdlet. It only happens when the subject is filled with a String parameter which contains invalid characters.

After two hours of troubleshooting I formatted the string with the following regex which worked in my case:

 

 

Leave a reply

Your email address will not be published.