質問

私のインストーラーは、またインストールされているWindowsサービスで基本的な構成を実行するために使用される構成exeを展開します。また、EXEはレジストリキーを作成して作成する必要があります。 Windows Server 2008環境では、これらのキーを作成できません。私は調査し、これが管理者の特権であり、EXEは2008年にUACの下で必要な管理者権限を促していないことを発見しました。しかし、これは理想的ではありませんが、クライアントにパフォーマンスを通知する必要がある余分なステップであるためです。 exeを実行するときに管理者権限を高める他の方法はありますか?

役に立ちましたか?

解決

exeにマニフェストを置きます。あなたが使用しているバージョンのどのバージョンを知らせれば、Visual Studioを使用してマニフェストを埋め込む方法を説明できます。 Visual Studioを使用していない場合、またはEXEを構築しない場合は、ManifestファイルをEXEと同じフォルダーに配置するだけで、それも機能します。その場合、ファイルはexeと同じ名前を付けなければなりません。最後に.manifest、たとえばfoo.exeの場合はfoo.exe.manifestです。コンテンツは次のようになります:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</asmv1:assembly>

RequestedExecutionLevelの可能な値がすべてコメントにあることに注意してください。今では常に高くなり、したがってあなたのために働きます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top