0
1

More than 3 years have passed since last update.

UAC有効環境かつ一般ユーザーでも管理者権限&管理者として実行する方法

Last updated at Posted at 2020-02-21

AutoItというツールを使用すれば実現可能。

Autoit 入門 (UWSCを超える簡単PC自動化ツール) |
http://take-web.com/cad/2017/10/autoit/#toc2

・au3形式で保存される。exe形式にコンパイルも可能。
・実行内容をbatやps1で外出しする。
 ※ローカル固定パスしか実行できないので注意

●作成手順
1.キッカーをpowershellで作成

kicker.ps1
$kickProgram = ".\execContent.bat"
$execProgram = ".\verbRunas.exe"

copy-item $kickProgram "c:\temp\" -force

start-process $execProgram -Wait

remove-item c:\temp\execContent.bat -force

2.実行内容をbatかpowershellで作成(内容:UAC無効化の例)

execContent.bat
REG ADD HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

3.管理者として実行するプログラムをAutoItで作成、exe形式にコンパイルする

verbRunas.au3
RunAs("ローカル管理者アカウント", @ComputerName, "ローカル管理者パスワード", 0, "powershell ""Start-Process c:\temp\execContent.bat -Verb Runas""", "", @SW_HIDE)

4.PowerGUIで1のpowershellファイルをコンパイル(※2,3を同梱する)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1