Run cmdlet on remote system which sends email

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 6 years, 4 months ago.

  • Author
  • #6117

    by OliAdams at 2013-03-23 08:13:37

    I have want to connect to a remote system and run a custom powershell cmdlet which creates and emails a html report. If I use invoke-command will it try and send the email from the remote system or from my machine? sorry for the poor explanation I am new to remoting with powershell.

    by DonJ at 2013-03-23 08:35:20

    Anything inside Invoke-Command will happen on the remote computer.

    Invoke-Command -ScriptBlock { Send-MailMessage -To whoeever -From whatever -Subject This -Body That } -ComputerName SERVER1

    SERVER1 would send the email.

    by OliAdams at 2013-03-23 09:11:31

    Thanks I thought as much just wanted to check as I do not get much time to test things on the systems I need to use.

You must be logged in to reply to this topic.