Created
June 12, 2021 17:50
-
-
Save it3xl/82a4e1858f3c9ee105a20239431f0053 to your computer and use it in GitHub Desktop.
PowerShell, make user an Administrator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For PoserShell 5.1 and above. | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Install-PackageProvider -Name NuGet -Force -Scope AllUsers | |
Install-Module -Name Microsoft.PowerShell.LocalAccounts -Force -Scope AllUsers | |
#Get-Module -ListAvailable -Name Microsoft.PowerShell.LocalAccounts | |
##Import-Module -Name Microsoft.PowerShell.LocalAccounts | |
Add-LocalGroupMember -Group Administrators -Member MyDomain\MyLogin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment