1 Reply Latest reply on Mar 24, 2014 8:42 AM by LANDave

    PowerShell task to add domain users to local group

    jwood8 Apprentice

      One last one, here's a quick PowerShell script which you can use to add a domain group (WindowsAdmins) to a local group, in this case Administrators. We add this as a provisioning step so that our desktop support team can administer the station once built. Nice and simple!

       

      $computername = Get-Content env:computername

      $adgroup =[ADSI]"WinNT://subdomain.domain.com/WindowsAdmins"

      $localgroup =[ADSI]"WinNT://$computername/Administrators"

      $localGroup.PSBase.Invoke("Add",$adgroup.PSBase.Path)