Run cmdlet on remote system which sends email

Welcome Forums General PowerShell Q&A 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, 10 months ago.

  • Author
    Posts
  • #6117

    Member
    Points: 0
    Rank: Member

    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.

The topic ‘Run cmdlet on remote system which sends email’ is closed to new replies.