Skip to content

Instantly share code, notes, and snippets.

@the-takeo
Created November 10, 2020 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-takeo/0b937f2f60dec959fab7c6d26f19d9e1 to your computer and use it in GitHub Desktop.
Save the-takeo/0b937f2f60dec959fab7c6d26f19d9e1 to your computer and use it in GitHub Desktop.
AutoSlmgr
# 期限切れ状態を取得。
# 期限切れの場合は「通知」という文字列が現れるので、resultが0以外になる。
$result = (cscript //Nologo C:\Windows\System32\slmgr.vbs /dli | Where-Object{$_ -Like "*通知*" }).length
if($result -ne 0)
{
slmgr -rearm
Restart-Computer -Force
}
else
{
#何もしない
}
@the-takeo
Copy link
Author

試用版Windowsの試用期間が切れたときに自動延長する。日本語環境限定。
日次でタスクスケジューラ等で動かすと試用期間切れを防ぐことが出来る。

長期間に渡る試用での利用を想定している。悪用厳禁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment