[TuT]How to make something run only as Admin

Posts 1–3 of 3 · Page 1 of 1
[TuT]How to make something run only as Admin
Hey guys. This TuT was originally posted by NextGen1. It was in another post and i thought not many people would have seen it. SO to make it more obvious, here it is. ALL credits go to him.


Show All files in your Solutions Explorer

Navigate to the Bin Folder ----> Debug ----> Applicationname.Vshost.exe.Manifest File

Double Click it and

add this code

Code:
PHP Code:
<?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"> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> </asmv1:assembly>
Replacing it with the existing code

or

Use the existing code

Code:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <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">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
The information is as follows

requireAdministrator:
highestAvailable:
asInvoker: Vb.net Default

So for this particular case it would be

Code:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <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">
        <requestedExecutionLevel level="requireAdministrator:" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

I was going to make a full Tutorial with how to use this, plus how to use it on a per sub basis, meaning if you want to require admin for a specific part of the code, but there is no need.

Hope this helps
Already Released, but Still Could Help Some People.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?