Thiết lập Scheduler Task chạy tự động file script PowerShell

Nhân dịp phải thiết lập cho một server chạy hệ điều hành Microsoft Windows Server 2012 R2 chạy tự động một file script powershell (.ps1) với Task Scheduler, dành thời gian ghi chép lại lỗi mà gặp phải trước đây khi mới tập tành làm quen với PowerShell version 1. Sau này mà quên thì tìm đọc lại.

Với các file batch như .cmd/.bat, trong phần Program/script mình trỏ đến đúng nơi lưu file batch .cmd/.bat.

Còn với file script powershell (.ps1), trong phần Program/script mình nhập vào powershell (hoặc powershell.exe) và phần Add arguments (optional) mới nhập đúng đường dẫn đến nơi lưu file script powershell.

Hình minh họa thiết lập chạy file backup-fileserver.ps1 lưu trong folder E:\_scripts\
Thiết lập Tash Scheduler chạy file script PowerShell
Thiết lập Tash Scheduler chạy file script PowerShell .ps1