Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

adding local users to local groups on a server via CSV

$
0
0

Hey guys,First, I am sorry if this is just completely dumb request, not much experience with this. if you have a moment can you take a look at the script. It’s designed to add a local user to a single local group, and it’s designed to do this for a single computer. I’d like to modify it, if possible, to read in a list of server names from a text file and then pass each server name iteratively to the script and also to add that user not to just one group but to two groups.

If(-not (Test-IsAdministrator)) { New-Underline “Admin rights are required for this script” ; exit }

if(!$user -or !$group) { $(Throw ‘A value for $user and $group is required.’) }

$OBjOU = [ADSI]”WinNT://$computer/$group1,group” $objOU.add(“WinNT://$computer/$user”)

I am very noobish with powershell, but our main person has left our company and I am trying to help out.Thanks for any advice or help

submitted by /u/Swag_monkey
[link] [comments]

The post adding local users to local groups on a server via CSV appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles