Send-MailMessage with Computer Account

Dorian P 1 Reputation point
2021-06-01T08:17:43.833+00:00

Hello,

I'm creating some script for some action in Windows Server. The script is executed with the "BUILTIN\SYSTEM" account.

This script need to send the result of the script with the command "Send-MailMessage", I want use the computer account to send the mail.

I don't allow on my exchange server anonymous connection.

Any idea?
Thank's for the help!

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,726 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,866 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,902 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,628 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andy David - MVP 155.4K Reputation points MVP
    2021-06-01T11:59:15.05+00:00

    Use a regular mailbox-enabled account or create a specific receive connector for just that server and allow anonymous access from just that server
    https://learn.microsoft.com/en-us/exchange/mail-flow/connectors/custom-receive-connectors?view=exchserver-2019#scenario-3-receive-messages-from-a-server-service-or-device-that-doesnt-use-exchange


  2. Rich Matheisen 47,786 Reputation points
    2021-06-01T14:55:54.117+00:00

    In addition to Andy's suggestion, you can store an encrypted password in a file and use it to create a credential. Use the credential (for an unprivileged user, of course) in the Send-MailMessage.

    Here's an example (it uses the old technique of creating the SMTP client, but you can ignore that):
    powershell-how-encrypt-and-store-credentials-securely-use-automation-scripts

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.