自升式批处理文件(非管理员用户) [英] Self-Elevating Batch file (non-Admin user)

查看:148
本文介绍了自升式批处理文件(非管理员用户)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们遇到与我们的一个下跌后的移动宽带调制解调器重新连接的问题。这个问题已经被提升,但一个解决方案可能需要一段时间。一个快速的工作中我们发现,周围是禁用和重新启用该设备,但是安全设置是这样的,在网络连接我们的用户无法启用/禁用网络适配器。

We're having an issue with our Mobile Broadband modem reconnecting after a drop. The issue has been elevated but a solution may take a while. A quick work around we found is disabling and re-enabling the device, however the security settings are such that our users can't enable/disable network adapters in Network Connections.

我创建一个批处理文件来处理禁用/启用,但会什么样子自我提升对非管理员用户。即使我必须努力code本地管理员帐户到文件,并将其转换成可执行隐藏code。这是我到目前为止有:

I created a batch file to handle the disable/enable but would like it to self-elevate for a non-Admin user. Even if I have to hardcode a local admin account into the file and convert it into an executable to hide the code. Here's what I have so far:

@echo off
echo Please wait while the Sprint modem is reset...
wmic path win32_networkadapter where name="Sierra Wireless Mobile Broadband Network Adapter" call disable
timeout /t 5 /nobreak
wmic path win32_networkadapter where name="Sierra Wireless Mobile Broadband Network Adapter" call enable

这完美的作品,如果我选择运行方式:联系。我真的AP preciate任何和所有帮助。

This works perfectly if I chose Run As: Admin. I really appreciate any and all help.

推荐答案

我也有过类似的问题,并与Windows任务计划程序的帮助下解决了。

I've had a similar problem and solved it with the help of the windows task scheduler.


  1. 创建它只是运行该bat文件调度程序中的一个新课题。

  2. 选择一个管理员用户作为acount与运行的任务。

  3. 输入密码(这里是很大的优势 - 你不需要将其存储在一些脚本,如纯文本)

  4. 创建一个包含以下内容的另一个bat文件:的schtasks /运行/ TN<&TASKNAME GT;

  5. 运行新的BAT文件。

如果这不起作用,则可能是因为nither具有运行任务权限的用户的。在这种情况下,你仍然必须存储的凭据以纯文本格式,但

If this doesn't work, it might be because of the user nither has permission to run tasks. In this case you'll still have to store the credentials as plain text but

的schtasks /运行/ U<用户名> / P<密码和GT; / TN<&TASKNAME GT;

就可以了。

这篇关于自升式批处理文件(非管理员用户)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆