如何以管理员身份自动运行 程序

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

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

  1. Open the Local Security Policy. (See Method A or B above)
  2. Expand the Local Polices folder, see the screenshot opposite.
  3. Drill down to Security Options folder.
  4. Scroll down, and locate the family of settings beginning with 'User Account Control'.
  5. Focus on: User Account Control: Behaviour of the elevation prompt for administrator.  Double click and set to: Elevate without prompting.  Check the screenshot below.
  6. Restart you Windows Server 2008 computer.
  7. 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.
  8. UAC should now be   turned off, thus you should not see the 'Continue' box.

Elevate without prompting - Disable UAC

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值