如何通过powershell为本地用户帐户分配用户权限? [英] How to assign user rights to a local user account through powershell?

查看:89
本文介绍了如何通过powershell为本地用户帐户分配用户权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想修改与本地用户帐户关联的用户权限.我想将组和用户添加到特定的用户权限.这是通过打开组策略并在控制台树中打开以下文件夹来完成的:计算机配置\Windows 设置\安全设置\本地策略\用户权限分配.然后单击所需的用户权限并将用户或组添加到其中.

I want to modify the user rights associated with a local user account.I want to add groups and users to a particular User Rights. This is done by opening the group policy and opening the following folder in the console tree: Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment. Then click on the required user Right and add the user or group to it.

是否可以通过 powershell 脚本执行相同的操作?

Is it possible to do the same through powershell scripts?

推荐答案

我要做的是打开 SecPol.msc,通过 GUI 对基准计算机进行修改,然后导出 .inf 模板以通过 powershell 进行安装.

What I would do is open SecPol.msc, make your modifications via the GUI to a baseline computer and export an .inf template for installation via powershell.

>

该模板可以通过 secedit.exe 安装.如果需要,您可以在文本编辑器中打开 inf 文件并滚动,直到看到 [Privilege Rights] 部分.举个例子.

[Privilege Rights]
SeDenyServiceLogonRight = *S-1-1-0,*S-1-5-19, KNUCKLE-DRAGGER

运行此命令并重新启动.根据需要编辑 .inf 和 .db 名称.

Run this command and reboot. Edit .inf and .db names as appropriate.

    secedit.exe /configure /cfg C:\customsettings.inf /db C:\WINDOWS\security\Database\customsettings.db /quiet

这篇关于如何通过powershell为本地用户帐户分配用户权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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