I’m trying to get the current user and add them to the Administrator Group. So far I’m able to get the current user and pass them to the Admin add, but I’m not sure how to call it with Admin credentials in order to actually add them.
$user = [Environment]::Username
$group = [ADSI]("WinNT://"+$env:COMPUTERNAME+"/administrators,group")
$group.add("WinNT://$env:USERDOMAIN/$User,user")
Any help would be appreciated.
Here is the working solution: