Converted to PowerShell
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# PowerShell version
|
||||
|
||||
Same functionality as the Python scripts in the repo root, ported for running on Windows
|
||||
Servers via Task Scheduler without needing a Python install.
|
||||
|
||||
## Setup
|
||||
|
||||
No dependencies to install — `Invoke-RestMethod` is built into Windows PowerShell 5.1+.
|
||||
|
||||
Uses the same `.env` file as the Python version (see `../.env.example`); by default it looks
|
||||
for `..\.env` relative to this script. Pass `-EnvFile` to point elsewhere, e.g. if you'd rather
|
||||
keep credentials outside the repo checkout entirely.
|
||||
|
||||
## Usage
|
||||
|
||||
```powershell
|
||||
.\post_notices.ps1 -NoticeType 2 -OrgIds 3,4,5,6,7,8
|
||||
```
|
||||
|
||||
- `-NoticeType`: the Notification Type ID to post.
|
||||
- `-OrgIds`: comma-separated Organization IDs to post notices for.
|
||||
- `-DeliveryOption`: optional, defaults to `1` (Mail) — currently the only value Polaris accepts.
|
||||
|
||||
Same caveat as the Python version: every run sends real notices to real patrons, and there's no
|
||||
dry-run mode.
|
||||
|
||||
## Task Scheduler
|
||||
|
||||
Action: `powershell.exe`
|
||||
Arguments: `-NoProfile -ExecutionPolicy Bypass -File "C:\path\to\PowerShell\post_notices.ps1" -NoticeType 2 -OrgIds 3,4,5,6,7,8`
|
||||
|
||||
If your Windows PowerShell execution policy blocks unsigned scripts by default, `-ExecutionPolicy
|
||||
Bypass` on the scheduled task action avoids having to change the machine-wide policy.
|
||||
Reference in New Issue
Block a user