- August 4, 2016 at 5:38 pm #49323
I've tried a zillion things in the Actions panel and I still get an opcode of 2, supposedly meaning the file can't be found...AND no events ever get written into the log like they are supposed to be. This is for a scheduled task running ON the Exchange 2010 server.
The parameters line is:
-version 2.0 -NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\scripts\Troubleshoot-DatabaseSpace.ps1 -Server e10 -PercentEdbFreeSpaceThreshold 10 -PercentLogFreeSpaceThreshold 10"
I get the same result if I point to this file in the Exchange scripts folder, I copied it from there into C:\scripts.
The action to run is:
The Start In is:
What is wrong with my setup, please????????
Scripts permission is RemoteSigned, the script works with all these parameters etc. if I manually run it from a batch file.
I've double-checked the presence of each file involved.
This is an Exchange 2010 on Windows Server 2008 R2, all current patches.
Thank you, TomAugust 8, 2016 at 8:49 pm #49632
What identity is running the task?August 8, 2016 at 8:57 pm #49644
It's being run with the Administrator login (domain admin account, highest privileges, run logged in or not).
The task runs but it doesn't do what it's supposed to do, put things into the event log.
Thank you, TomAugust 8, 2016 at 9:19 pm #49652
That being the case, it's honestly hard to say without being able to sit in front of it and explore. Have you tried running a very simple script, that perhaps doesn't use Exchange at all, just to see if you can get ANYTHING to run as a Task?August 8, 2016 at 10:08 pm #49658
I'll try using another simple Exchange script...
I had similar problems with a login monitoring script...and gave up.
But now I really need to figure out doing something like this. 🙂
Thank you, TomAugust 12, 2016 at 1:31 pm #50144
Does the host where the script resides have the same EMS as the Exchange servers? Some commands won't run even if you include a 'load snapin' command : Add-PSSnapin Microsoft.Exchange.Management.Powershell.E2010
Been caught out with this before!August 12, 2016 at 1:35 pm #50146
The scheduled task IS running ON the Exchange 2010 server. As administrator.
I have not had opportunity to work on this b/c of putting out fires...
Thank you, TomAugust 12, 2016 at 2:04 pm #50152
I had similar problems....
Running this from my exchange server's Task Scheduler works great:
Add arguments: -command ". 'D:\Program Files\Microsoft\Exchange Server\V15\Bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; c:\scripts\sep_attack.ps1"
Have you tried removing ' -Server e10 -PercentEdbFreeSpaceThreshold 10 -PercentLogFreeSpaceThreshold 10' and seeing if it works? Maybe just add a read-host at the end of your script to see what its doing?August 12, 2016 at 2:23 pm #50156
One is required to put the -server parameter so the script knows which server to work on.
I think I tried removing the other params.
It will be a couple weeks before I can get back to this.
Thank you, TomAugust 15, 2016 at 10:56 am #50428
Are you tried to run your command from cmd and not task scheduler?
Fine if cmd will be executed from the same user as in task scheduler
runas /user:domain\requireuser cmd
>powershell -command ........
and when you see that it executed exactly as you need and produce output you need, just copy/paste latest command to scheduler
- This reply was modified 1 month, 2 weeks ago by Max Kozlov.
You must be logged in to reply to this topic.