Problem in Exchange 2007 Powershell Schedule Task to run
Hi Team
Currently am struggling with Exchange 2007 powershell schedule task
i have a powershell script which will create HTML fiile to find the current Active Node in CCR
The Script is working fine and creating the HTML file without any issue.
so, i am thinking of to put the script in schedule task to run the PS1 script for each 1 Hour. the HTML file report which is having the current time and date in that
created a bat file
PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command ". 'D:\ramki\clusteractivemon.ps1'"
Whenever the task runs, it is not creating the HTML file , but when i run the bat manaully by duble clicking, the HTML files created with correct time and date.
Say for example. Scripts scheduled by 9.00 AM to start by 10AM
Task ran at 10.00AM but no HTML created at 10.00 AM
but when i manually double click the BAT file by 10.10 or any time, HTML file is created without any issue
i had created in Task Schedular in Windows 2008 server ---> created a basic task
I wonder , why my scripit is not working in Schedule task.
Could any one please help me
Appreciate your fast response
ramakrishnan
May 19th, 2012 4:48am
HI Thanks
What i did was ....
Craeted a notepad file and copy the below and saved as test.bat file . Saved it in my D: drive (Location : D:\Ramki\Clumon.bat)
PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command ". 'D:\ramki\clusteractivemon.ps1'"
then gone to schedule task and craeted the basic task -->Action Menu -->Start a program selected the test.bat file to run
also i tried to open the .PS1 file to run directly via basic task -->Action Menu -->Start a program selected the clusteractivemon.ps1' file to run
it opens the .PS1 file in notepad
am i doing anything wrong
ramakrishnan
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2012 6:33am
Hi,
I don't understand the need to create a bat file.
Why not just call your Powershell script directly?
Just copy the hole string to Program/Script when you create the Task.
One more thing...are you running the script with a user account or SYSTEM? Test with System if you're not using it.Martina Miskovic
May 19th, 2012 6:52am
Hi
No Luck still
Once i did run the task as per the above , the task runs but not creating the output file (HTML file) from the PS1
Basically, whenever the script (PS1) runs from the powershell command it will create a HTML file with current date and time
but when i put the same script in the schedeule task it won't create the HTML file
ramakrishnan
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2012 2:02pm
One more thing...are you running the script with a user account or SYSTEM? Test with System if you're not using it.
Martina Miskovic
What is the answer to my question?Martina Miskovic
May 19th, 2012 2:25pm