最後に Windows 2019 Server を自動的に再起動する必要がある Inno Setup 6.0.3 を使用してセットアップを作成しました。
ただし、UAC 設定が次のように設定されている場合 - ユーザー アカウント制御設定: アプリがコンピューターに変更を加えようとした場合にのみ通知する (デフォルト)
ユーザーがWindows エクスプローラーでセットアップ ファイルをダブルクリックしてセットアップを開始し、[はい、今すぐコンピューターを再起動します] を選択すると、次のエラーが表示されます - 「セットアップでコンピューターを再起動できませんでした。手動で実行してください」
必要な [Setup] ディレクティブ PrivilegesRequired と AlwaysRestart を含めました
[Setup]
PrivilegesRequired=admin
ChangesEnvironment=yes
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName=test\MyProduct
AlwaysRestart=yes
セットアップ ログは、Windows を再起動するための Inno セットアップ コードが呼び出されたことを示しています。
2019-11-25 01:28:22.755 Process exit code: 1
2019-11-25 01:28:22.976 Need to restart Windows? Yes
2019-11-25 01:28:25.083 Deinitializing Setup.
2019-11-25 01:28:25.087 Restarting Windows.
2019-11-25 01:28:25.098 Log closed.
ただし、inno setup がアクセス許可を昇格できなかったため、API ExitWindows が失敗し、Windows が起動せず、上記のエラー メッセージが表示されます。
ノート:
- また、「管理者として実行」を右クリックして明示的にセットアップを実行すると、自動再起動が正常に機能します。
- UAC がオフになっている場合、つまり「通知しない...」に設定されている場合、ユーザーが Windows エクスプローラーでセットアップ ファイルをダブルクリックしてセットアップを開始しても、自動再起動が機能します。
これは既知の問題ですか、それとも [Setup] ディレクティブに何か不足していますか?
完全なログに失敗しました:
2019-11-25 01:28:19.079 Log opened. (Time zone: UTC-08:00)
2019-11-25 01:28:19.079 Setup version: Inno Setup version 6.0.3 (u)
2019-11-25 01:28:19.079 Original Setup EXE: C:\viren\Output\mysetup.exe
2019-11-25 01:28:19.079 Setup command line: /SL5="$5065A,721408,721408,C:\viren\Output\mysetup.exe" /SPAWNWND=$C0662 /NOTIFYWND=$3A0222 /ALLUSERS
2019-11-25 01:28:19.080 Compatibility mode: Yes (Installer)
2019-11-25 01:28:19.080 Windows version: 10.0.17763 (NT platform: Yes)
2019-11-25 01:28:19.080 64-bit Windows: Yes
2019-11-25 01:28:19.080 Processor architecture: x64
2019-11-25 01:28:19.080 User privileges: Administrative
2019-11-25 01:28:19.082 Administrative install mode: Yes
2019-11-25 01:28:19.083 Install mode root key: HKEY_LOCAL_MACHINE
2019-11-25 01:28:19.083 64-bit install mode: No
2019-11-25 01:28:19.087 Created temporary directory: C:\Users\ADMINI~1\AppData\Local\Temp\is-7REUJ.tmp
2019-11-25 01:28:21.790 Calling RestartManager's RmGetList.
2019-11-25 01:28:21.800 RmGetList finished successfully.
2019-11-25 01:28:21.800 RestartManager found no applications using one of our files.
2019-11-25 01:28:21.820 Starting the installation process.
2019-11-25 01:28:21.829 Directory for uninstall files: C:\Program Files (x86)\MyOrg
2019-11-25 01:28:21.839 Will append to existing uninstall log: C:\Program Files (x86)\MyOrg\unins000.dat
2019-11-25 01:28:21.880 -- File entry --
2019-11-25 01:28:21.881 Dest filename: C:\Program Files (x86)\MyOrg\unins000.exe
2019-11-25 01:28:21.884 Time stamp of our file: 2019-11-25 01:28:18.741
2019-11-25 01:28:21.884 Dest file exists.
2019-11-25 01:28:21.884 Time stamp of existing file: 2019-11-25 01:25:14.078
2019-11-25 01:28:21.885 Version of our file: 51.1052.0.0
2019-11-25 01:28:22.111 Version of existing file: 51.1052.0.0
2019-11-25 01:28:22.111 Installing the file.
2019-11-25 01:28:22.203 Leaving temporary file in place for now.
2019-11-25 01:28:22.205 Saving uninstall information.
2019-11-25 01:28:22.205 Renaming uninstaller.
2019-11-25 01:28:22.207 Deleting uninstall key left over from previous administrative 32-bit install.
2019-11-25 01:28:22.207 Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0940EFBB-D1FC-4C6F-91E0-996D9E40B2A5}_is1
2019-11-25 01:28:22.208 Writing uninstall key values.
2019-11-25 01:28:22.210 Detected previous non administrative install? No
2019-11-25 01:28:22.210 Detected previous administrative 64-bit install? No
2019-11-25 01:28:22.216 Installation process succeeded.
2019-11-25 01:28:22.230 -- Run entry --
2019-11-25 01:28:22.230 Run as: Current user
2019-11-25 01:28:22.230 Type: Exec
2019-11-25 01:28:22.230 Filename: certutil
2019-11-25 01:28:22.230 Parameters: -f -p xyz -importpfx "C:\MyOrg\NMX\CertFiles\Some-Certificate.pfx"
2019-11-25 01:28:22.462 Process exit code: 0
2019-11-25 01:28:22.463 -- Run entry --
2019-11-25 01:28:22.463 Run as: Current user
2019-11-25 01:28:22.463 Type: Exec
2019-11-25 01:28:22.463 Filename: netsh
2019-11-25 01:28:22.463 Parameters: http add sslcert ipport=0.0.0.0:443 certhash=458A6AXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx84059B8 appid={7CE058D3-892A-4318-9D3C-41FA3D8C6CE2}
2019-11-25 01:28:22.755 Process exit code: 1
2019-11-25 01:28:22.976 Need to restart Windows? Yes
2019-11-25 01:28:25.083 Deinitializing Setup.
2019-11-25 01:28:25.087 Restarting Windows.
2019-11-25 01:28:25.098 Log closed.
完全なログ WORKING
2019-11-25 05:08:50.911 Log opened. (Time zone: UTC-08:00)
2019-11-25 05:08:50.911 Setup version: Inno Setup version 6.0.3 (u)
2019-11-25 05:08:50.911 Original Setup EXE: C:\viren\Output\mysetup.exe
2019-11-25 05:08:50.911 Setup command line: /SL5="$22031A,721408,721408,C:\viren\Output\mysetup.exe"
2019-11-25 05:08:50.912 Compatibility mode: Yes (Installer)
2019-11-25 05:08:50.912 Windows version: 10.0.17763 (NT platform: Yes)
2019-11-25 05:08:50.912 64-bit Windows: Yes
2019-11-25 05:08:50.912 Processor architecture: x64
2019-11-25 05:08:50.912 User privileges: Administrative
2019-11-25 05:08:50.913 Administrative install mode: Yes
2019-11-25 05:08:50.913 Install mode root key: HKEY_LOCAL_MACHINE
2019-11-25 05:08:50.913 64-bit install mode: No
2019-11-25 05:08:50.917 Created temporary directory: C:\Users\ADMINI~1\AppData\Local\Temp\is-9VKDA.tmp
2019-11-25 05:08:53.798 Calling RestartManager's RmGetList.
2019-11-25 05:08:53.810 RmGetList finished successfully.
2019-11-25 05:08:53.810 RestartManager found no applications using one of our files.
2019-11-25 05:08:53.833 Starting the installation process.
2019-11-25 05:08:53.840 Directory for uninstall files: C:\Program Files (x86)\MyOrg
2019-11-25 05:08:53.856 Will append to existing uninstall log: C:\Program Files (x86)\MyOrg\unins000.dat
2019-11-25 05:08:53.861 -- File entry --
2019-11-25 05:08:53.862 Dest filename: C:\Program Files (x86)\MyOrg\unins000.exe
2019-11-25 05:08:53.865 Time stamp of our file: 2019-11-25 05:08:50.653
2019-11-25 05:08:53.865 Dest file exists.
2019-11-25 05:08:53.865 Time stamp of existing file: 2019-11-25 01:28:18.741
2019-11-25 05:08:53.865 Version of our file: 51.1052.0.0
2019-11-25 05:08:54.165 Version of existing file: 51.1052.0.0
2019-11-25 05:08:54.166 Installing the file.
2019-11-25 05:08:54.305 Leaving temporary file in place for now.
2019-11-25 05:08:54.309 Saving uninstall information.
2019-11-25 05:08:54.309 Renaming uninstaller.
2019-11-25 05:08:54.313 Deleting uninstall key left over from previous administrative 32-bit install.
2019-11-25 05:08:54.314 Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0940EFBB-D1FC-4C6F-91E0-996D9E40B2A5}_is1
2019-11-25 05:08:54.315 Writing uninstall key values.
2019-11-25 05:08:54.316 Detected previous non administrative install? No
2019-11-25 05:08:54.316 Detected previous administrative 64-bit install? No
2019-11-25 05:08:54.325 Installation process succeeded.
2019-11-25 05:08:54.347 -- Run entry --
2019-11-25 05:08:54.347 Run as: Current user
2019-11-25 05:08:54.347 Type: Exec
2019-11-25 05:08:54.347 Filename: certutil
2019-11-25 05:08:54.347 Parameters: -f -p xyz -importpfx "C:\MyOrg\NMX\CertFiles\Some-Certificate.pfx"
2019-11-25 05:08:54.542 Process exit code: 2147942402
2019-11-25 05:08:54.544 -- Run entry --
2019-11-25 05:08:54.544 Run as: Current user
2019-11-25 05:08:54.544 Type: Exec
2019-11-25 05:08:54.545 Filename: netsh
2019-11-25 05:08:54.545 Parameters: http add sslcert ipport=0.0.0.0:443 certhash=xxxxxxxxdffdsafdsfdsafsafsdafsa appid={7CE058D3-892A-4318-9D3C-41FA3D8C6CE2}
2019-11-25 05:08:55.150 Process exit code: 1
2019-11-25 05:08:55.365 Need to restart Windows? Yes
2019-11-25 05:08:57.032 Deinitializing Setup.
2019-11-25 05:08:57.037 Restarting Windows.
2019-11-25 05:08:57.050 Log closed.