Does everyone here uses windows task scheduler to automate your scripts? How about other alternatives e.g. Adaxes or is that too much?
If so what is the method you are using? Creating a batch?
“Windows+R” and then typing “taskschd.msc”
Action > Create task
General tab > Run whether user is logged on or not
Triggers tab > New then choose time
Actions tab > New then choose Action: Start a programProgram\script: powershellAdd arguments (optional): -File c:\path\yourscript.ps1
You want to store any passwords used in scheduled scripts as encrypted text files in order to not be prompted e.g. to make an encrypted password:
$pass = Read-Host "Enter Password" -AsSecureString$pass | ConvertFrom-SecureString | Out-File "C:\temp\yourusername.cred.txt"
To reuse this in a hash table of credentials: Password = get-content C:\temp\chris.spencer.cred.txt | convertto-securestring
We use Task Scheduler but I have only a few script I currently run automatically.
For the command line I use (for 32-bit powershell):
Then in the add arguments:
-NoLogo -NonInteractive -File "C:\Path\To\Scripts\Prod\PowerShellScript.ps1"
By our side we use system center Orchestrator (microsoft) which do the job
Highly recommend this method by Brain guys: