SHARE
TWEET

Untitled

a guest Aug 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [CmdletBinding()]
  2. Param(
  3.      [Parameter(Mandatory=$True,Position=0)]
  4.      [alias("user","name")]
  5.      [string]
  6.      $UserName,
  7.      [Parameter(Mandatory=$False,Position=1)]
  8.      [string]
  9.      $ComputerName = 'localhost',
  10.      [Parameter(Mandatory=$False)]
  11.      [string]
  12.      $Domain = 'WORKGROUP'
  13.      )
  14.  
  15. $Group = 'Administrators'
  16.  
  17. # Please be warned. The syntax of [ADSI] is CASE SENSITIVE!
  18. $target=[ADSI]"WinNT://$ComputerName/$Group,group"
  19. $target.psbase.Invoke("Add",([ADSI]"WinNT://$Domain/$UserName").path)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top