elevated-privileges

Elevated Credentials for VB6

元气小坏坏 提交于 2019-12-06 12:41:32
问题 I need to get elevated credentials (to start a service) in a VB6 application, but only if the user needs to restart the service (I.e. I don't want to get elevated credentials whenever the application is started, only when the user selects restart). How can I do this in VB6? 回答1: Fairly easy, but the preferred way involves a new elevated process. This example uses itself run with a switch to know to perform the Service Start instead of normal operations: VERSION 5.00 Begin VB.Form Form1

Marshal.GetActiveObject(“Outlook.Application”) throws MK_E_UNAVAILABLE when debugging with elevated privileges

做~自己de王妃 提交于 2019-12-05 22:53:46
问题 This code run without problem in release r debug when Visual studio isn't started as an admin. Marshal.GetActiveObject("Outlook.Application"); However, when I start Vs as administrator and run the same line in debug, I get the following error: System.Runtime.InteropServices.COMException Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) How can I fix this. 回答1: I would guess that you are running Visual Studio as Administrator (started via Run as Administrator) while

Removing Administrator Privilages from Process

不打扰是莪最后的温柔 提交于 2019-12-05 08:50:12
With the help of this great MSDN article , my first idea was to simply check if the process is using an elevated Administrator group, and using AdjustTokenGroups() I would set the Administrator group to SE_GROUP_USE_FOR_DENY_ONLY . Unfortunately though, we can't modify the administrator group on the currently running process as it also has the SE_GROUP_MANDATORY attribute, which makes it inelligable for changing. The MSDN document has this to say about it: The AdjustTokenGroups function cannot disable groups with the SE_GROUP_MANDATORY attribute in the TOKEN_GROUPS structure. Use

Getting error - Access is denied in OpenProcess() after enabling privileges

房东的猫 提交于 2019-12-04 20:50:02
I want to get executable path of csrss process. I enabled privileges, but GetLastError() function returns error 5 in OpenProcess. I'm running Visual Studio as administrator and compiling program in 64bit mode, also I'm using Windows 8. Thanks to all. HANDLE hcurrentProcess=GetCurrentProcess(); HANDLE hToken; size_t error; if (!OpenProcessToken(hcurrentProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return nullptr; if (CheckTokenPrivilege(hcurrentProcess, SE_DEBUG_NAME)) { LUID luid; if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) return nullptr; TOKEN_PRIVILEGES newState

Elevated Credentials for VB6

孤者浪人 提交于 2019-12-04 19:54:38
I need to get elevated credentials (to start a service) in a VB6 application, but only if the user needs to restart the service (I.e. I don't want to get elevated credentials whenever the application is started, only when the user selects restart). How can I do this in VB6? Fairly easy, but the preferred way involves a new elevated process. This example uses itself run with a switch to know to perform the Service Start instead of normal operations: VERSION 5.00 Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "Form1" ClientHeight = 3060 ClientLeft = 45 ClientTop = 345 ClientWidth =

How to remote execute an ELEVATED remote script in PowerShell

微笑、不失礼 提交于 2019-12-04 11:23:36
问题 I have two servers: serverA (windows 2003 server) serverB (windows 7) ServerA contains a folder with a batch file (deploy.bat) that needs to be executed from an elevated powershell prompt. In ServerA , if I run it from a normal prompt or powershell prompt it fails. If I run it from an elevated prompt it works. (run as administrator). The problem I have is when I try to execute batch file from serverB using a remote powershell execution. I am able to execute with this command: Invoke-Command

How do I make a console app always run as an administrator?

此生再无相见时 提交于 2019-12-04 08:31:30
问题 I have a console application that was developed to be called by a erp software. They call my app inside the erp and when they do it, i always get errors related to the insufficient permission to do it. I have checked the "run this program as an administrator" checkbox in the properties of the exe for all users but the result is the same. I have read something about adding a manifest that will make the app prompt for the uac dialog, but thats not what i want because the app will be called from

Marshal.GetActiveObject(“Outlook.Application”) throws MK_E_UNAVAILABLE when debugging with elevated privileges

我的未来我决定 提交于 2019-12-04 04:36:54
This code run without problem in release r debug when Visual studio isn't started as an admin. Marshal.GetActiveObject("Outlook.Application"); However, when I start Vs as administrator and run the same line in debug, I get the following error: System.Runtime.InteropServices.COMException Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) How can I fix this. I would guess that you are running Visual Studio as Administrator (started via Run as Administrator) while Outlook was opened as user, who was logged in as under Windows logon. So the Visual Studio is running under

Can I modify a Win7 environment to allow a .Net program to always run as Administrator?

本秂侑毒 提交于 2019-12-04 03:24:55
We are about to roll out several hundred new machines running windows 7, with the OS installed via WDS so at the moment we can make changes and sysprep them into the build. The problem is a .Net app we wrote years ago which itself spawns a modified command shell. That shell runs a dataflex application that itself needs to run with elevated permissions. We don't grant users any general admin rights. Is there a mechanism where we can pre-allow our .Net app to run as administrator so that the command control runs as Administrator? I'm aware of the changes I can make in the app.manifest to require

How do I make a console app always run as an administrator?

房东的猫 提交于 2019-12-02 23:39:18
I have a console application that was developed to be called by a erp software. They call my app inside the erp and when they do it, i always get errors related to the insufficient permission to do it. I have checked the "run this program as an administrator" checkbox in the properties of the exe for all users but the result is the same. I have read something about adding a manifest that will make the app prompt for the uac dialog, but thats not what i want because the app will be called from erp on the server and clients will not see the dialog on server. Can someone explain me how to make