TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Powershell- Create a group & Change the owner of an existing SharePoint group
Gowtham Rajamanickam
Mar 08
2015
Code
4.3
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
$url =
"http://urltoweb"
$GroupName =
"Enter the Group Name"
$GroupOwner1 =
"SharePoint Admins"
$GroupOwner2 = $GroupName+
" Security Admin"
$SPSite =
New
-
Object
Microsoft.SharePoint.SPSite($url)
$OpenWeb = $SPSite.OpenWeb()
$OpenWeb.SiteGroups.Add($GroupName+
" Designers"
,$OpenWeb.SiteGroups[$GroupOwner1],$OpenWeb.SiteUsers[
""
],
"Members of this group can edit lists, document libraries, and pages in the site. Designers can create Master Pages and Page Layouts in the Master Page Gallery and can change the behavior and appearance of each site in the site collection by using the master pages and CSS files."
)
$OpenWeb.Update() $OpenWeb.Dispose() $SPSite.Dispose();
Modify the existing group and change the owner.
#Get the SPWeb
$web =
Get
-SPWeb http://urltoweb
#Get the Group
$group = $web.SiteGroups[
"Enter the Group Name"
]
#Get the User
$user = $web.EnsureUser(
"domain\username"
)
#Assign that user as the owner
$group.Owner = $user
#Update the Group
$group.Update()
Sharepoint
PowerShell
Sharepoint2013
Group