Author Posts

January 1, 2012 at 12:00 am

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.