Solved

How to use this powershell script?

Posted on 2012-03-20
2
635 Views
Last Modified: 2012-03-21
I would like to create security groups on SharePoint 2010 using powershell. I found this script http://sharepointryan.com/2011/07/20/create-sharepoint-groups-using-powershell/ but since I am new to powershell I don't really know how to use it. Can somebody walk me through it?
0
Comment
Question by:MisUszatek
[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 3

Assisted Solution

by:Sherif_Talaat
Sherif_Talaat earned 75 total points
ID: 37746757
This script create a PowerShell function called "New-SPGroup" that accept the following parameters:

- SharePoint Web URL
- Group Name
- Group Owner
- Member Name
- Description

In order to use this method, you can simply execute this script to create a new PowerShell called "New-SPGroup" in your runspace, then use it to create the groups you want like the example below:

New-SPGroup -Web http://intranet -GroupName "Test Group" -OwnerName DOMAIN\User -MemberName DOMAIN\User2 -Description "My Group"
0
 
LVL 38

Accepted Solution

by:
Justin Smith earned 275 total points
ID: 37746760
Copy this to a text doc and save it as CreateGroups.ps1 (you can name it whatever you want).

Bring up SharePoint Management Console and navigate to the folder that contains the script.  You have to "dot source" the file to make the function available to use.  Type . .\CreateGroups.ps1 and hit enter.  

Now you can use the New-SPGroup commandlet.  For example....

New-SPGroup -Web http://intranet -GroupName "Test Group" -OwnerName DOMAIN\User -MemberName DOMAIN\User2 -Description "My Group"

This example creates a group called "Test Group" in the http://intranet site, with a description of "My Group".  The owner is DOMAIN\User and the first member of the group is DOMAIN\User2.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

688 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