Answer: Schedule a PowerShell script to run in Windows Server 2003 requires the use of .bat script that calls a PowerShell scripts.
There for we need to create two scripts:
- PowerShell scripts
- .bat script that calls the PowerShell script
To schedule a Task to run a PowerShell scripts under a Windows Server 2003 follow the steps below:
Create a PowerShell script and save it as .Ps1
On the server set the execution policy to unrestricted:
Create a .bat file with a link to the Powershell Script:
powershell -command “& ‘c:\scripts\test.ps1’ ”
Browse to the Script location
Enter username and password for the script to run
Modify the task if needed.