O que é equivalente para o ntrights.exe no Windows 10?
Grant, Revoke, Query user rights (privileges) using PowerShell
100% pure PowerShell solution to grant, revoke, and query user rights (privileges), such as "Log on on as a service". Works on local or remote computers.
Download
Description
I've been searching for a way to grant the "Logon as a Service" right to a user account with pure PowerShell for a while. But, I found the same buggy, incomplete code over and over on the Internet. So, I wrote my own and expanded the functionality.
Benefits:
- No dependency on external EXE files
- Can modify any user right; is not limited to "Logon as a Service"
- Can add/remove rights from the current process token
- Doesn't write temporary files during operation
- Fully pipeline-able
- Pure PowerShell implementation
- Supports changing user rights on remote machines
- Fully documented and self contained
- No code hidden in DLL files or other compiled libraries; fully transparent
Available Cmdlets:
- Grant-UserRight
- Revoke-UserRight
- Get-UserRightsGrantedToAccount
- Get-AccountsWithUserRight
- Grant-TokenPrivilege
- Revoke-TokenPrivilege
How to use:
Import the .ps1 file, and use get-help -detailed for syntax on each cmdlet. Powershell must be running with administrative rights.
Powershell
# To include from another script: Import-Module .\UserRights.ps1 # or, Dot-Source for use from command prompt: . .\UserRights.ps1
Example:
Powershell
# Grants Tony "Log on as a service" right Grant-UserRight tony.pombo SeServiceLogonRight
Powershell
# Gets a list of all accounts with "Log on as a service" right Get-AccountsWithUserRight SeServiceLogonRight
Powershell
# Very bad - Don't actually try this!!!! # Removes all user rights granted to Administrators and Everyone' Get-UserRightsGrantedToAccount "Administrators","Everyone" | Revoke-UserRight
source