So in fact you need to set "runas" on ProcessStartInfo. With the attached manifest this code now works fine on Windows XP, Vista and 7. Update: See also this answer to a similar question. This is basically the same code, just using arguments as well. You need to call Process. Start with the login credentials of a user with administrative priviliges. You can use the runas command.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 10 years, 11 months ago. Active 10 years, 11 months ago. Viewed 6k times. Improve this question. Community Bot 1 1 1 silver badge. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. How do I start control panel with runas in Windows XP? Ask Question. Asked 9 years, 7 months ago. Active 7 years, 6 months ago. Viewed 27k times. Is control panel designed not to be startable from a non-admin profile as an admin user? Improve this question. MrVimes MrVimes 1, 6 6 gold badges 18 18 silver badges 34 34 bronze badges.
Add a comment. Active Oldest Votes. Improve this answer. Printers is the one I wanted to start. Won't work for Printers, as noted in the answer. Show 3 more comments. The use of runas is not restricted to administrator accounts, although that is the most common use. Any user with multiple accounts can use runas to run a program, MMC console, or Control Panel item with alternate credentials.
You can run them as an administrator while you are logged on to your computer as a member of another group, such as the Users or Power Users group. As long as you provide the appropriate user account and password information, the user account has the ability to log on to the computer, and the program, MMC console, or Control Panel item is available on the system and to the user account.
With the runas command, you can administer a server in another domain or forest the computer from which you run a tool and the server you administer are in different domains or forests. If you try to start a program, MMC console, or Control Panel item from a network location using runas , it might fail because the credentials used to connect to the shared network resource are different from the credentials used to start the program.
The latter credentials may not be able to gain access to the same shared network resource. Some items, such as the Printers folder and desktop items, are opened indirectly and cannot be started with the runas command. If the runas command fails, the Secondary Logon service might not be running or the user account you are using might not be valid. To test the user account, try logging on to the appropriate domain using the account.
Group Policy is not processed for the user whose credentials are supplied to the runas command. This is by design. The runas command can load the user profile of the secondary user whose identity is being used to create the process, and that user profile may contain registry keys and values from previous interactive logons when Group Policy was processed for that user.
0コメント