Exchange2010sp1 scheduled Powershell task not executing unless domain administrator is logged in
Hello,
I have a annoying problem in that I have created a powershell script to export mailboxes to pst files. This PS1 file is called via a .bat file which if i run when logged into the box
as the domain admin its not a problem.
However if i try to schedule this job it will not run & when I logg into the box I can see the task cmd.exe in the taskmgr view.
Any ideas why this could be happening ?
Below is the contents of the PS1 file
# ExportMailbox.ps1 - Export mailbox of users and output to pst file on
\\server01\public
New-MailboxExportRequest -Mailbox martin -FilePath
\\server01\public\martin.pst
-----------------------------------------------------------------------------------------------------------------
Below is the bat file which calls the PS1 script during the scheduled task execution
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\Scripts\ExportMailbox.ps1"
Things I've checked:
- Confirmed that Run task even if user is not logged on has being ticked & credentials saved
- Tried including path C:\Scripts\ in the "Start in field"
I absoultely cannot see where I'm going wrong.
Thanks in advance.
January 10th, 2011 12:00am
Hi,
Did you changed the path for SysWOW64 folder too?
Also check powershell execution policy, which prevents the script from running. Type get-executionpolicy in a powershell to see what it actually is set to. Type set-executionpolicy e.g. set-executionpolicy RemoteSignedRegards from www.windowsadmin.info
Free Windows Admin Tool Kit Click here and download it now
January 10th, 2011 12:49am
Hi ManU Philip,
It appears that I've fixed the glitch.
What I did was tick the box that says "Run with highest privilige" which is located at the bottom of the
Scheduled Task 'Security Options'.
I noticed this ticked in another Exchange Powershell script - Database redundancy monitoring task ((one of those created during install of exchange).
I've being able to replicate it by un-ticking the mentioned check-box.
Best Regards,
Martin
January 10th, 2011 1:09am