none
How To Set A Process To Run As A System / Administrator Process Once Installed RRS feed

  • Question

  • Hello,

    I have been developing networking software using Microsoft Visual Studio 2017, and created an installer for the software using this toolkit  (https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.MicrosoftVisualStudio2017InstallerProjects). However, what I would  like to know is how to format the installer so that my software runs as a SYSTEM or administrator process once installed.

    Thank you very much.


    keiferbly

    Sunday, February 4, 2018 9:26 AM

Answers

All replies

  • Hello,

    Is your app is WinRT or classic desktop app. If app is WnRT then it doesn't support Administrator mode. If it is classic Win32 app then you can add manifest file and set "requestedExecutionLevel" flag.


    Make the community better together


    Sunday, February 4, 2018 6:23 PM
  • It is a classic Windows Forms Application (Win32). I am new to using the installer creating toolkit mentioned, so please tell me how I would add the manifest file, thank you very much.

    keiferbly

    Sunday, February 4, 2018 6:52 PM
  • You can add manifest file by following steps 

    Right click your project file on the Solution Explorer, select Add, then New item. There you can find Application Manifest File.

     and set requestedExecutionLevel to 

      <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" />
    
                Specifying requestedExecutionLevel element will disable file and registry virtualization. 
                Remove this element if your application requires this virtualization for backwards
                compatibility.
            -->
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
          </requestedPrivileges>


    Make the community better together

    Monday, February 5, 2018 7:44 AM
  • This is strange; despite having the package installed, I am not seeing a "manifest file" option.

    Below are images of the options I am seeing. Thank you.


    keiferbly

    Monday, February 5, 2018 8:26 AM
  • What version of VisualStudio do you using?

    Make the community better together

    Monday, February 5, 2018 9:10 PM
  • Visual Studio 2017 Community Edition, thanks.

    keiferbly

    Monday, February 5, 2018 9:37 PM
  • Anyway you can manually add is 

    Add new XML file in project root (with Build Action = None) with following content

    <?xml version="1.0" encoding="utf-8"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
      <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" />
    
                Specifying requestedExecutionLevel element will disable file and registry virtualization. 
                Remove this element if your application requires this virtualization for backwards
                compatibility.
            -->
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
          </requestedPrivileges>
        </security>
      </trustInfo>
    
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
          <!-- A list of the Windows versions that this application has been tested on and is
               is designed to work with. Uncomment the appropriate elements and Windows will 
               automatically selected the most compatible environment. -->
    
          <!-- Windows Vista -->
          <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
    
          <!-- Windows 7 -->
          <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
    
          <!-- Windows 8 -->
          <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
    
          <!-- Windows 8.1 -->
          <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
    
          <!-- Windows 10 -->
          <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
    
        </application>
      </compatibility>
    
      <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
           DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need 
           to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should 
           also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
      <!--
      <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
          <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
        </windowsSettings>
      </application>
      -->
    
      <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
      <!--
      <dependency>
        <dependentAssembly>
          <assemblyIdentity
              type="win32"
              name="Microsoft.Windows.Common-Controls"
              version="6.0.0.0"
              processorArchitecture="*"
              publicKeyToken="6595b64144ccf1df"
              language="*"
            />
        </dependentAssembly>
      </dependency>
      -->
    
    </assembly>
    

    after change its name and extension to app.manifest , unload the project and right click and select and Edit then in Project node add new PropertyGroup

    <PropertyGroup>
        <ApplicationManifest>app.manifest</ApplicationManifest>
    </PropertyGroup>
    reload project and build and run it

     

    Make the community better together

    Tuesday, February 6, 2018 7:17 AM
  • Thank you. However, once I have done what you said, and rebuilt the project, the installer does not show up in the folder visual studio says it compiled to.

    After doing all you said, here is the Visual Studio compiler output:

    1>------ Rebuild All started: Project: Peer, Configuration: Release Win32 ------
    2>------ Rebuild All started: Project: Client, Configuration: Release x86 ------
    1>stdafx.cpp
    2>  Client -> C:\Users\keife\Desktop\quasar\QuasarRAT-master\Bin\Release\Client.exe
    2>          1 file(s) copied.
    1>DoorSocket.cpp
    1>FullScreenOpDlg.cpp
    1>MyRDPSessionEvents.cpp
    1>Peer.cpp
    1>PeerDlg.cpp
    1>rdpviewer1.cpp
    1>Service.cpp
    1>TrayIcon.cpp
    1>ViewerDlg.cpp
    1>Generating code
    1>All 327 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
    1>Finished generating code
    1>Peer.vcxproj -> C:\Users\keife\Desktop\Desktop Stuff\Network Remote\Peer\Release\Peer.exe
    3>------ Skipped Rebuild All: Project: NetworkRemoteClient, Configuration: Release ------
    3>Project not selected to build for this solution configuration 
    ========== Rebuild All: 2 succeeded, 0 failed, 1 skipped ==========

    Why might this be happening?

    Thank you.



    keiferbly

    Tuesday, February 6, 2018 8:01 AM
  • Hi keiferbly,

    I will move your thread later since this forum is only for Windows App Studio Beta related issues.

    Thanks for your understanding.

    Best Regards,

    Annie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 7, 2018 3:13 AM
  • I'd try asking for help over here.

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?category=windowsforms

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=visualstudiogeneral

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=windowsgeneraldevelopmentissues

     

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Wednesday, February 7, 2018 3:31 AM
    Moderator
  • Hello,

    I have read this post. yes this is very much help ful. Thank you

    Wednesday, February 7, 2018 6:35 AM
  • Hello,

    I have been developing networking software using Microsoft Visual Studio 2017, and created an installer for the software using this toolkit  (https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.MicrosoftVisualStudio2017InstallerProjects). However, what I would  like to know is how to format the installer so that my software runs as a SYSTEM or administrator process once installed.

    shuvo

    Wednesday, February 7, 2018 6:41 AM
  • shuvo, please refer to the forums Dave linked above.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)


    Sunday, February 11, 2018 9:26 AM
    Moderator
  • Will do, thank you.

    keiferbly

    Monday, February 12, 2018 8:58 AM
  • You're welcome.

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Monday, February 12, 2018 1:22 PM
    Moderator