Solved

importing users to Security group

Posted on 2016-11-02
2
62 Views
Last Modified: 2016-11-02
Dear experts
could you please help me with this one?

I have a security group that I exported users via PowerShell to a csv file and  I now need to import those users into a new Universal security group but I am receiving  an error from PowerShell during import process.

this is the full code I used.

Import-Module ActiveDirectory
$list =import-csv "H:\temp\export\usg_users.csv
foreach ($user in $list) {
add-ADGroupMember -identity USG-Security GroupNAme -member $user.SamAccountname
}
error is
Add-ADgroupmember: A positional parameter cannot be found that accepts argument "GroupNAme"

there is a - and  space in the actual security group name in AD. so name is written such as USG-Customer Services

any ideas why I am receiving this please? thanks.
0
Comment
Question by:kuzum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 41870076
You need to enclose the group name in quotes.
Add-ADGroupMember -Identity 'USG-Security GroupName' -Member $user.SamAccountname

Open in new window

0
 

Author Closing Comment

by:kuzum
ID: 41870121
Hi,

I used " " and it also did the worked just after posting the question. Thanks for your time.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question