Add domain users to an local group on a remote pc

A simple script, but very handy!

 Any comments or questions are welcomeBig Smile

PS. Fill in your own domain!

Anonymous
Parents
No Data
Comment
  • Functionized and mod to just the administrators group:

    Function Add-LocalAdmin {

    param(

       # user logon id (samAccountname)

       $user,

       # computer name

       $ComputerName

       )

    $objUser = [ADSI]("WinNT://<change this to your domain>/$user")  

    $objGroup = [ADSI]("WinNT://$ComputerName/Administrators")  

    $objGroup.PSBase.Invoke("Add",$objUser.PSBase.Path)

    }

Children
No Data