While I do love PowerShell, simple is better (that's why PowerShell is generally better than most other automation solutions - it's simple). In this case, the net command is as simple as you can get and has no explicit external dependencies like ADSI.
J From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Murray, Mike Sent: Monday, July 21, 2014 11:44 AM To: mssms@lists.myitforum.com Subject: [mssms] PowerShell noob question I'm trying to deploy a PowerShell script that will add a security group to the administrators group on all the machines in a particular collection. I found the script below. Can you tell me if my example below that will work properly? Or would I be better of simply running "net localgroup administrators /add DomainA\User1" within PowerShell? # use one line to add a user to a local group ([ADSI]"WinNT://$computer/$Group,group").psbase.Invoke("Add",([ADSI]"WinNT://$domain/$user").path) # # # use one line to add a user to a local group ([ADSI]"WinNT://$computer/$Group,Administrators").psbase.Invoke("Add",([ADSI]"WinNT://$mydomain/$Group").path) # # Best Regards, Mike Murray Desktop Management Coordinator - IT Support Services California State University, Chico 530.898.4357 mmur...@csuchico.edu<mailto:mmur...@csuchico.edu>