Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Powershell- Create a group & Change the owner of an existing SharePoint group
WhatsApp
Gowtham Rajamanickam
Mar 08
2015
4.4
k
0
0
$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
Up Next
Powershell- Create a group & Change the owner of an existing SharePoint group