1. runas 命令要输密码,所以还是不行
2.创建shortcut,右击属性设置成管理员运行的话,直接点击可以以管理员身份运行,但是如果放到task 里面运行的话还是不行,最后运行的还不是管理员身份
3.用c#,参数可以自己穿,不过运行的话,UAC必须disable 掉
例如
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
ProcessStartInfo proc = new ProcessStartInfo();
proc.UseShellExecute = true;
proc.FileName = @"C:\Users\DailyRun.bat";
proc.WorkingDirectory = @"C:\Windows\System32\";
proc.Verb = "runas";
Process.Start(proc);
}
}
}
二:disable UAC
If you feel a little guilty when you disable the UAC - join the club. Many techies:
a) Get rid of the nagging 'Continue' pop-up message box.
b) Feel shamefaced at turning off this Windows Server 2008 security feature.
c) Sometime later, they realize that the UAC is necessary for security, and turn it back on.
Microsoft's introduction of UAC reminds me of the governments introduction of seat belts in the 1970s. Both were unpopular at first, but eventually, the majority see the advantages of safety over ease-of-use.
As someone who hated the UAC at first, I can say that now I have turned it back on, firstly, it's not THAT irritating, secondly it sends a subliminal message 'Guy work securely'. Thirdly, as an unexpected bonus the delay, or pause, that UAC introduces makes me think more about the action I am about take. - No bad thing!
- Local Policy - Elevate without prompting
- Run all administrators in Admin Approval Mode
- Registry Hack - ConsentPromptBehaviorAdmin
- How to Activate the Hidden Windows Server 2008 Administrator Account
Local Policy - Elevate without prompting
For computers that have joined a domain, 'Elevate without prompting' is the best Local Policy method for disabling the UAC pop-up. For Windows Server 2008 Home Editions, or any Windows Server 2008s not joined to the a domain see below.
Stage 1) Preliminary task:
Our first task is simply to launch the Local Security Policy snap-in. You have the choice of two methods:
Method A) Begin by clicking on Windows Server 2008's Start button, then type secpol.msc in the Start Search dialog box. Note: you must include the .msc extension. See more on Secpol
Method B) The goal is to display Windows Server 2008's Administrative Tools. Firstly, right-click the Taskbar, select Properties. Next navigate this path: Start Menu, Customize, Advanced; scroll to the bottom and find System Administration Tools, place the radio button next to 'Display on the All Programs menu'.
Stage 2) Configure the Security Options
- Open the Local Security Policy. (See Method A or B above)
- Expand the Local Polices folder, see the screenshot opposite.
- Drill down to Security Options folder.
- Scroll down, and locate the family of settings beginning with 'User Account Control'.
- Focus on: User Account Control: Behaviour of the elevation prompt for administrator. Double click and set to: Elevate without prompting. Check the screenshot below.
- Restart you Windows Server 2008 computer.
- When the computer restarts, try to configure a tasks that needs UAC. For example, change the computer's display name. Press the Windows Key + Pause / Break. Select the 'Change Settings' shield.
- UAC should now be turned off, thus you should not see the 'Continue' box.