当前位置:网站首页>组策略中开机脚本与登录脚本所使用的用户身份
组策略中开机脚本与登录脚本所使用的用户身份
2022-07-03 18:36:00 【51CTO】
在组策略中,我们可以使用启动/关机,登录/注销这些动作作为执行脚本的事件。

启动/关机脚本在计算机配置菜单下面,登录/注销脚本在用户配置菜单下面。顾名思义,计算机配置是全局的,权限肯定是比较高。用户配置是针对用户环境的,权限肯定是限定的。
我们通过一个实验来看看当运行 组策略-计算机配置-启动脚本,以及 组策略-用户配置-登录脚本 的时候,具体是用什么用户身份来运行的。
首先,windows环境变量里面,%username%是当前用户名,%userprofile%是当前用户配置路径,%homepath%是当前用户主目录路径,%appdata%是当前用户数据文件夹。whoami /user命令除了显示用户名还能显示SID。
写一个脚本包含如下内容:
whoami /user >>x:\test.txt
echo %username%,%userprofile%,%homepath%,%appdata%>>x:\test.txt
注意保存路径我们给它everyone读写权限。
然后分别做成开机脚本和登录脚本。
测试机电脑操作系统是win10,名称为test,使用users权限的账号名称为ceshi。
最后验证如下:
开机脚本的情况
whoami显示使用的是nt authority\system账号,sid是S-1-5-18
%username%是TEST$ ,——在电脑名称后加了$符号
%userprofile%是C:\Windows\system32\config\systemprofile
%homepath%显示为空
%appdata%显示为C:\Windows\system32\config\systemprofile\AppData\Roaming
登录脚本的情况
whoami显示使用的是 域名\ceshi,sid就是S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXX-XXXX
%username%是ceshi
%userprofile%是C:\Users\ceshi
%homepath%是\Users\ceshi
%appdata%是C:\Users\ceshi\AppData\Roaming
显然,开机脚本所使用的身份是system用户,具有超过administrators的权限
而登录脚本则是使用了当前登录用户的身份和权限。所以对于某些必须以管理员运行的命令登录脚本是用不了的。
边栏推荐
- Implementation of cqrs architecture mode under Kratos microservice framework
- There are several levels of personal income tax
- G1 garbage collector of garbage collector
- On Data Mining
- [combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation example 2 | extended to integer solution)
- How to quickly view the inheritance methods of existing models in torchvision?
- TypeScript 官网教程
- [combinatorics] exponential generating function (example 2 of solving multiple set permutation with exponential generating function)
- CV in transformer learning notes (continuously updated)
- [tutorial] build your first application on coreos
猜你喜欢

Xception for deeplab v3+ (including super detailed code comments and original drawing of the paper)
![Golang string (string) and byte array ([]byte) are converted to each other](/img/41/20f445ef9de4adf2a2aa97828cb67f.jpg)
Golang string (string) and byte array ([]byte) are converted to each other

2022-2028 global physiotherapy clinic industry research and trend analysis report

Raft 日志复制

Sensor debugging process

Why can deeplab v3+ be a God? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)

Computer graduation project PHP library book borrowing management system

How do microservices aggregate API documents? This wave of operation is too good

Implementation of cqrs architecture mode under Kratos microservice framework
![AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]](/img/3d/6d61fefc62063596221f98999a863b.png)
AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]
随机推荐
How about the Moco model?
G1 garbage collector of garbage collector
Mysql45 lecture learning notes (II)
How to track the real-time trend of Bank of London
TypeScript 官网教程
Valentine's day, send you a little red flower~
CV in transformer learning notes (continuously updated)
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
[untitled]
198. Looting - Dynamic Planning
Unity2018 to wechat games without pictures
On Data Mining
What London Silver Trading software supports multiple languages
Have you learned the correct expression posture of programmers on Valentine's day?
统计图像中各像素值的数量
Use of unsafe class
Computer graduation design PHP sports goods online sales system website
Opencv learning notes (continuously updated)
[combinatorics] generating function (generating function application scenario | using generating function to solve recursive equation)
Enterprise custom form engine solution (12) -- form rule engine 2