$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...
Showing posts with label UserGroups. Show all posts
Showing posts with label UserGroups. Show all posts
Jan 7, 2013
Jan 6, 2013
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...
Add Users to SharePoint Group using PowerShell
#Get the site name to the variable
$web = Get-SPWeb SitURLHere
#Get the group name to the variable
$groupName = $web.SiteGroups["Group Name Here"]
#Assign user to variable
$user = $web.Site.RootWeb.EnsureUser(“User ID Here”)
#Add user to group
$groupName.AddUser($user)
Write-Host -ForegroundColor green "User Added Successfully";...
Apr 7, 2012
Exporting SharePoint User Groups with Group Names
In the article Exporting
SharePoint User Groups into Excel, we have learned about exporting the
SharePoint user groups into excel. Here we are able to export all the users in
a SharePoint site but we are unable to sort the
users with the group name.
In this article, we will learn a small work
around filter the users with the group name.
We can use SQL Query to
fetch this data.
Connect to the SQL...