I'm currently working on a script which will read a mail from a certain sender, who will be sending some commands for the scripts to run.
The Main Idea:
Sender sends a mail with a command for example: ipconfig /all > result.txt
and the script running at the recipients side copies this command to a .bat file and running the .bat file to process the command.
The Code:
$junk = $routlook.GetDefaultFolder(23)
$MI = $junk.items
foreach($m in $MI)
{
if($m.SenderEmailAddress -eq '<sender-address>')
{
Echo "@ECHO OFF" > com.bat
Echo $MI.item(1).Body > com.bat
.\com.bat
}
break
}