2016年10月21日 星期五

Use Task Scheduler to run a PowerShell script during every startup

Use Task Scheduler to run a PowerShell script during every startup
 
要建立一則工作來啟動虛擬機器,用右鍵按點新的工作資料夾,並選 'Create Basic Task...'。給它一個名稱及描敘。於 Trigger 選擇 'When the computer starts',而於 Action 選擇 'Start a program'。當被問到Program/script, 輸入 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe' 到欄位裡。(請根據你的 PowerShell 位置來調整。) 在 Add arguments (optional) 欄位,輸入 '-File "E:\Scripts\Auto-VMs.ps1" start'。
 
 
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
 
 '-executionpolicy remotesigned -File "c:\sendemail\sendemail.ps1" start'

沒有留言:

張貼留言