Export SharePoint Group to Excel using PowerShell
Export all groups and Namesadd-pssnapin microsoft.sharepoint.powershell
#get the site object
$site = Get-SPSite "http://alenaldev.tawazun.ae/"
#get the group collection details
$groups = $site.RootWeb.sitegroups
#output variable is been used for storing the group details.
$Output = @("GroupName")
#loop thru the groups object and get the individual group details.
foreach ($grp in $groups)
{
Write-Host "Group: " $grp.name;
foreach ($user in $grp.users) {
Write-Host "user:" $user.Name
$Output += ($grp.Name+"|"+$user.Name+"|"+$user.UserLogin+"|"+$user.Email)
}
}
$site.Dispose()
#finally export the group names to the .csv file
$Output > "C:\ ExportGroups.csv"
-----------------------------------------------------
$siteUrl="SiteURLHere" $groupName="GroupNametoExport" $Output = @("GroupName|Name|Login|Email|Department|Title") $web = Get-SPWeb $siteUrl $site = $web.Site $rootWeb = $site.RootWeb $UserList = $rootWeb.Lists["User Information List"] $web.SiteGroups[$groupName].Users|%{$user = $UserList.GetItemById($_.ID) if($user -ne $null) { $JobTitle = $user["JobTitle"] $Department = $user["Department"] } $Output += ($groupName+"|"+$_.Name+"|"+$_.UserLogin+"|"+$_.Email+"|"+$ Department +"|"+$JobTitle) } $rootWeb.Dispose() $web.Dispose() $site.Dispose() $Output > "D:\MembersExport.csv"
Import Users from Excel to SharePoint using PowerShell
# Import the .csv file, and specify manually the headers, without column name in the file $userList=IMPORT-CSV C:\UserToUpload.csv -header("GroupName","UserName") #Get the site name to the variable $web = Get-SPWeb SiteURLHere foreach ($user in $userList) { $groupName = $web.SiteGroups[$userList.group] $user = $web.Site.RootWeb.EnsureUser($userList.user) $groupName.AddUser($user) } Write-Host -ForegroundColor green "Users Added Successfully" } $Web.Dispose()REF:http://sharepoint-works.blogspot.in/2013/01/import-users-from-excel-to-sharepoint.html#.UO1bvnfSKBw
Great post! I am see the programming coding and step by step execute the outputs.I am gather this coding more information. It's helpful for me my friend. Also great blog here with all of the valuable information you have.
ReplyDeleteSharepoint Training in Chennai
Really nice experience you have. Thank you for sharing. It will surely be an experience to someone.
ReplyDeleteClick here:
angularjs training in bangalore
Click here:
angularjs training in pune
Thank you for an additional great post. Exactly where else could anybody get that kind of facts in this kind of a ideal way of writing? I have a presentation next week, and I’m around the appear for this kind of data.
ReplyDeleteClick here:
angularjs Training in online
Click here:
angularjs training in annanagar
This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
ReplyDeleteBlueprism training in annanagar
Blueprism training in velachery
Blueprism training in marathahalli
Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
ReplyDeleteDevops Training in Chennai
Devops Training in Bangalore
hank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me
ReplyDeletejava training in chennai | java training in bangalore
java online training | java training in pune
I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thx again!
ReplyDeleteData Science Training in Indira nagar
Data Science Training in Electronic city
Python Training in Kalyan nagar
Data Science training in Indira nagar
I'm here representing the visitors and readers of your own website say many thanks for many remarkable
ReplyDeleteangularjs Training in marathahalli
angularjs interview questions and answers
angularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in chennai
you have brainstormed my mind with your excellent blog. Thanks for that!
ReplyDeleteSelenium Training in Chennai
Selenium Training
iOS Training in Chennai
Digital Marketing Training in Chennai
core java training in chennai
Selenium Interview Questions and Answers
Future of testing professional
cloud computing training in chennai
cloud computing training
Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging...
ReplyDeleteAngularJS Training in Bangalore | AngularJS Course Fees | AngularJS 6 - i Digital Academy
- AngularJS Training in Bangalore - Learn AngularJS 6 from Expert Real-time Trainers at i Digital Academy with Live Projects and Placement Assistance. Book a Free Demo Today.
Great site you have got here.. It’s difficult to find high quality writing like yours these days. I truly appreciate individuals like you! Take care!!
ReplyDeleteThis is nice article with useful information.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
"Thanks for sharing this information with us...
ReplyDeleteDigital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery
"
Such an useful blog.Keep blogging.Java training in Chennai
ReplyDeleteJava training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
Great Blog!!! Was an interesting blog with a clear concept. And will surely help many to update them.keep it up
ReplyDeleteAngular js Training in Chennai
Angular js Training in Velachery
Angular js Training in Tambaram
Angular js Training in Porur
Angular js Training in Omr
Angular js Training in Annanagar
I was looking for this certain information for a long time. Thank you and good luck.
ReplyDeleteamazon web services aws training in chennai
microsoft azure training in chennai
workday training in chennai
android-training-in chennai
ios training in chennai
I was looking for this certain information for a long time. Thank you and good luck.
ReplyDeleteIELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
Spoken english classes in chennai | Communication training
Great info thankyou
ReplyDeletedata science training in chennai
ccna training in chennai
iot training in chennai
cyber security training in chennai
ethical hacking training in chennai
exim classes
ReplyDeleteEVERYTHING ABOUT EXPORT IMPORT. We are Providing All Topic Videos; We are Providing Online Training; We are Providing Offline Training. - <a href="https://www.onlineexim.com/export-importracticaltraining.php/www.onlineexim.com/export-import-practical-training.phpl</a