osagarana
asked on
RedistributeActiveDatabases.ps1 not running via Task Scheduler
Hi Experts,
Environment: Exchange 2010 SP2 + Windows 2008 R2
I am having some issues to run a built-in Exchange Script using Task Scheduler.
I have no issues running the script manually like:
.\RedistributeActiveDataba ses.ps1 -DagName DAG01 -BalanceDbsByActivationPre ference -confirm:$false
My task scheduler shows as completed successfully (0x0). But nothing happens.
I already changed the quotes several times but so far no luck.
Here it is how the task is set:
Run whether user is logged on or not - checked
Run with highest privileges - checked
Program/script: poweshell.exe
Add arguments: -command ". 'c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExcha nge.ps1'; Connect-ExchangeServer -auto; 'c:\Program Files\Microsoft\Exchange Server\V14\Scripts\Redistr ibuteActiv eDatabases .ps1 -DagName DAG01 -BalanceDbsByActivationPre ference -confirm:$false'"
Does anyone has any idea why the script is not running via Task?
It runs fine manually.
The user has the highest permission(Administrator).
Regards
Environment: Exchange 2010 SP2 + Windows 2008 R2
I am having some issues to run a built-in Exchange Script using Task Scheduler.
I have no issues running the script manually like:
.\RedistributeActiveDataba
My task scheduler shows as completed successfully (0x0). But nothing happens.
I already changed the quotes several times but so far no luck.
Here it is how the task is set:
Run whether user is logged on or not - checked
Run with highest privileges - checked
Program/script: poweshell.exe
Add arguments: -command ". 'c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExcha
Does anyone has any idea why the script is not running via Task?
It runs fine manually.
The user has the highest permission(Administrator).
Regards
Does the user have Exchange permissions? Running powershell commands will require the user (domain account) to be assigned the Exchange role access necessary to perform the action.
ASKER
Hi Jason,
The user "Administrator" has Domain Admins, Enterprise Admins, Schema Admins and Organization Management.
The user "Administrator" has Domain Admins, Enterprise Admins, Schema Admins and Organization Management.
ASKER
ahhh...and the "Administrator" is local adminstrator as well.
ASKER
no idea guys?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Subsun,
Unfortunately it did not work.
The history of the Task Scheduler says Action completed with return code 0. It means kind of completed successfully 0x0
However the script did not run. I mean, the "RedistributeActiveDatabas es.ps1" did not do the job.
If I run this thing manually it works from Powershell:
c:\Program Files\Microsoft\Exchange Server\V14\Scripts
.\RedistributeActiveDataba ses.ps1 -DagName DAG01 -BalanceDbsByActivationPre ference -confirm:$false
I am changing the quotes everywhere. Some give 0x0(good) and some give 0x1(wrong). But none of them have ran the script properly.
This script is built-in for Exchange 2010(DAG rebalancing). It should not be difficult to run. :-(
Unfortunately it did not work.
The history of the Task Scheduler says Action completed with return code 0. It means kind of completed successfully 0x0
However the script did not run. I mean, the "RedistributeActiveDatabas
If I run this thing manually it works from Powershell:
c:\Program Files\Microsoft\Exchange Server\V14\Scripts
.\RedistributeActiveDataba
I am changing the quotes everywhere. Some give 0x0(good) and some give 0x1(wrong). But none of them have ran the script properly.
This script is built-in for Exchange 2010(DAG rebalancing). It should not be difficult to run. :-(
What if you run the following from command prompt..
Powershell -command ". 'c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto;. 'c:\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1' -DagName DAG01 -BalanceDbsByActivationPreference -confirm:$false"
ASKER
Sorry. You are definately a genius. It worked you said.
Nice!