add logged in user to local administrators group powershell site:www.reddit.com
$LocalhostSession= New-PSSession -ComputerName localhost -Credential $mycreds
$Arguments = @($username)
$sb= {Param ([string]$username); $de = [ADSI]"WinNT://$env:computername/administrators,group"; $de.psbase.Invoke("Add",([ADSI]"WinNT://domain.net/$username").path)}
Invoke-Command -ComputerName $env:COMPUTERNAME -Session $LocalhostSession -ArgumentList $Arguments -ScriptBlock $sb
Also in C++:
- pc specs linux command
- pip install tensorflow no matching distribution found for tensorflow
- sbt scala install ubuntu
- ubuntu command get my ip
- crontab is not running my shell script
- how to install nvm in ubuntu
- terminal git add ssh key
- clean local branches git
- upgrade dart in flutter
- how to host angular on github
- command prompt change directory to network drive
- how to git commit and push
- scp copy recursive
- git config global
- undo last commit but keep changes
- install jira
- github as database
- cut first two fields
- how to take output of command in cp linux
- docker container
- run google chrome from terminal
- bash cd too many arguments
- update branch with master
- push a project to an existing repoin github using git