当前位置:网站首页>组策略中开机脚本与登录脚本所使用的用户身份
组策略中开机脚本与登录脚本所使用的用户身份
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的权限
而登录脚本则是使用了当前登录用户的身份和权限。所以对于某些必须以管理员运行的命令登录脚本是用不了的。
边栏推荐
- Class exercises
- How about the Moco model?
- [combinatorics] generating function (use generating function to solve the combination number of multiple sets R)
- Transformer T5 model read slowly
- [combinatorics] exponential generating function (concept of exponential generating function | permutation number exponential generating function = combinatorial number ordinary generating function | e
- webcodecs
- Unsafe类的使用
- English grammar_ Noun classification
- Unity2018 to wechat games without pictures
- How do microservices aggregate API documents? This wave of operation is too good
猜你喜欢

How to analyze the rising and falling rules of London gold trend chart

NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon

Prototype inheritance..

How many convolution methods does deep learning have? (including drawings)
![网格图中递增路径的数目[dfs逆向路径+记忆dfs]](/img/57/ff494db248171253996dd6c9110715.png)
网格图中递增路径的数目[dfs逆向路径+记忆dfs]

How to draw non overlapping bubble chart in MATLAB
![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

Real time split network (continuous update)

Unity webgl optimization

On Data Mining
随机推荐
041. (2.10) talk about manpower outsourcing
PHP determines which constellation it belongs to today
Bidding procurement scheme management of Oracle project management system
2022-2028 global solid phase extraction column industry research and trend analysis report
简述服务量化分析体系
webcodecs
Torch learning notes (5) -- autograd
网格图中递增路径的数目[dfs逆向路径+记忆dfs]
Image 24 bits de profondeur à 8 bits de profondeur
[combinatorics] generating function (use generating function to solve the combination number of multiple sets R)
What London Silver Trading software supports multiple languages
Sensor debugging process
What is SQL get connection
Shell script return value with which output
2022-2028 global lithium battery copper foil industry research and trend analysis report
Redis cache avalanche, penetration, breakdown
After nohup NPM start &, close the shell window directly, and the process closes accordingly
2022-2028 global aircraft head up display (HUD) industry research and trend analysis report
Ping problem between virtual machine and development board
[combinatorics] generating function (positive integer splitting | repeated ordered splitting | non repeated ordered splitting | proof of the number of repeated ordered splitting schemes)