How do I import all users from an OU into sharepoint
-
03-12-2019 - |
Pregunta
How do I get user profile service to create the associated users in SharePoint and put them into a specified user group?
Solución
Why would you want to do that? If you've setup your user profile service, you can use that to sync your user profiles into SharePoint. It does a bunch more stuff, but basically that's it.
If you want to do things like provide access to your portal to everyone in your AD, you can just grant rights to NT AUTORITY\Authenticated Users and all users will have access. There's even options in the people picker to choose all users.
If you want specific groups to have access instead, you can also do that by either granting rights to Active Directory groups, or creating groups of users within SharePoint and granting rights to those. So when you've got a new employee coming in, just add an AD account, add that account to the appropriate group and you're off.
And if this is not a valid answer, please provide some more details on why you'd want to acheive this.
Otros consejos
If this is SharePoint 2010, Try a PowerShell looking something like this (note: not tested, use at own risk and test throughly, if your AD melts into the ground after this I'm not responsible, yadda yadda)
Add-PsSnapin Microsoft.SharePoint.PowerShell
$Dom = "LDAP://OU=(your OU),DC=(your domain)"
$Root = New-Object DirectoryServices.DirectoryEntry $Dom
$selector = New-Object DirectoryServices.DirectorySearcher
$selector.SearchRoot = $root
$adobj= $selector.findall() where {
$_.properties.objectcategory -like "CN=Person*"
}
foreach ($person in $adobj)<br/>
{
$prop=$person.properties
Set-SPUser -Identity $prop.cn -Web (your SharePoint Site) -Group (your sharepoint group)
}