Solved

How to use this powershell script?

Posted on 2012-03-20
2
614 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now