Skip to content

Commit 8c7fe25

Browse files
committed
docs(for-windows): add taskschd.msc nvidia-smi power saving docs and script
- Rename for-windows.md to for-windows/README.md to support subdirectory structure - Add taskschd.msc overview docs under docs/misc/for-windows/taskschd.msc/ - Add nvidia-smi power saving task docs with usage and command reference - Add register-nvidia-smi-power-saving.ps1 to register a scheduled task that locks GPU clocks (180–3090MHz) at system startup for power saving
1 parent 65e6ed4 commit 8c7fe25

4 files changed

Lines changed: 138 additions & 0 deletions

File tree

File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# タスクスケジューラ用スクリプト集
2+
3+
`tasks/` 以下に配置してある。
4+
5+
## nvidia-smi-power-saving
6+
7+
`nvidia-smi` コマンドを使い、RTX 5090 の電力消費を抑えるタスクを作る。
8+
9+
初回起動時に実行される。
10+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# NVIDIA GPU クロック固定タスク登録スクリプト
2+
3+
システム起動時に `nvidia-smi` を実行し、GPU クロックを固定することで消費電力を削減する
4+
Windows タスクスケジューラのタスクを登録する PowerShell スクリプト。
5+
6+
## 概要
7+
8+
| 項目 | 内容 |
9+
|------|------|
10+
| スクリプト | `register-nvidia-smi-power-saving.ps1` |
11+
| タスク名 | `nvidia-smi power saving` |
12+
| 実行タイミング | システム起動時 |
13+
| 実行コマンド | `nvidia-smi -lgc 180,3090` |
14+
15+
`-lgc 180,3090` は GPU クロックの下限を 180MHz、上限を 3090MHz に固定するオプション。
16+
17+
## 要件
18+
19+
- Windows 8 / Windows Server 2012 以降
20+
- NVIDIA GPU ドライバ(`nvidia-smi.exe``C:\Windows\System32\` に存在すること)
21+
- PowerShell(管理者権限)
22+
23+
## 使い方
24+
25+
PowerShell を**管理者権限**で開き、以下を実行する:
26+
27+
```powershell
28+
.\register-nvidia-smi-power-saving.ps1
29+
```
30+
31+
実行確認なしに登録したい場合は `-Confirm:$false` を付ける:
32+
33+
```powershell
34+
.\register-nvidia-smi-power-saving.ps1 -Confirm:$false
35+
```
36+
37+
## 使用コマンドレット
38+
39+
`ScheduledTasks` モジュール(Windows 組み込み)を使用している。
40+
41+
| コマンドレット | 役割 |
42+
|----------------|------|
43+
| `New-ScheduledTaskAction` | 実行するコマンドとオプションを定義 |
44+
| `New-ScheduledTaskTrigger` | 起動タイミング(ブート時)を定義 |
45+
| `New-ScheduledTaskPrincipal` | 実行ユーザーと権限レベルを定義 |
46+
| `New-ScheduledTaskSettingsSet` | タスクの詳細設定を定義 |
47+
| `Register-ScheduledTask` | タスクをスケジューラに登録 |
48+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#Requires -RunAsAdministrator
2+
<#
3+
.SYNOPSIS
4+
Register a scheduled task to lock NVIDIA GPU clocks for power saving.
5+
6+
.DESCRIPTION
7+
This script registers a Windows Task Scheduler task that runs nvidia-smi
8+
at system startup to lock the GPU clock speed between 180MHz and 3090MHz,
9+
reducing power consumption.
10+
11+
Uses the ScheduledTasks PowerShell module (built-in since Windows 8/Server 2012)
12+
instead of a hardcoded XML export, making it portable across machines and users.
13+
14+
.EXAMPLE
15+
.\register-nvidia-smi-power-saving.ps1
16+
17+
.NOTES
18+
Requires Administrator privileges.
19+
Requires NVIDIA GPU with nvidia-smi.exe installed.
20+
#>
21+
22+
[CmdletBinding(SupportsShouldProcess)]
23+
param()
24+
25+
Set-StrictMode -Version Latest
26+
$ErrorActionPreference = 'Stop'
27+
28+
# --- Constants ---
29+
$TaskName = 'nvidia-smi power saving'
30+
$NvidiaSmiPath = 'C:\Windows\System32\nvidia-smi.exe'
31+
$NvidiaSmiArgs = '-lgc 180,3090'
32+
$TaskDescription = 'Lock GPU clocks to minimum 180MHz and maximum 3090MHz for power saving at system startup.'
33+
34+
# --- Validate nvidia-smi exists ---
35+
if (-not (Test-Path -LiteralPath $NvidiaSmiPath)) {
36+
Write-Error "nvidia-smi.exe not found at '$NvidiaSmiPath'. Please ensure NVIDIA drivers are installed."
37+
exit 1
38+
}
39+
40+
# --- Build task components ---
41+
42+
# Action: run nvidia-smi with clock lock arguments
43+
$action = New-ScheduledTaskAction `
44+
-Execute $NvidiaSmiPath `
45+
-Argument $NvidiaSmiArgs
46+
47+
# Trigger: run at every system startup
48+
$trigger = New-ScheduledTaskTrigger -AtStartup
49+
50+
# Principal: run as the current user, elevated, without storing a password (S4U)
51+
# S4U (Service For User) logon type allows the task to run even when the user
52+
# is not interactively logged in, without requiring password storage.
53+
$principal = New-ScheduledTaskPrincipal `
54+
-UserId "$env:USERDOMAIN\$env:USERNAME" `
55+
-LogonType S4U `
56+
-RunLevel Highest
57+
58+
# Settings: mirror the original XML settings
59+
$settings = New-ScheduledTaskSettingsSet `
60+
-MultipleInstances IgnoreNew `
61+
-DisallowStartIfOnBatteries `
62+
-StopIfGoingOnBatteries `
63+
-AllowHardTerminate `
64+
-StartWhenAvailable `
65+
-ExecutionTimeLimit (New-TimeSpan -Hours 1) `
66+
-Priority 7
67+
68+
# --- Register the task ---
69+
if ($PSCmdlet.ShouldProcess($TaskName, 'Register-ScheduledTask')) {
70+
Register-ScheduledTask `
71+
-TaskName $TaskName `
72+
-Action $action `
73+
-Trigger $trigger `
74+
-Principal $principal `
75+
-Settings $settings `
76+
-Description $TaskDescription `
77+
-Force
78+
79+
Write-Host "Task '$TaskName' registered successfully." -ForegroundColor Green
80+
}

0 commit comments

Comments
 (0)