powershell 限制网站集的人员选择器的Active Directory路径。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 限制网站集的人员选择器的Active Directory路径。相关的知识,希望对你有一定的参考价值。
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 27.11.2012
# Description: Limit site collection's Active Directory path for people picker.
# ----------------------------------------------
# Initialize
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
cls
#########################################################################################
function SetUserAccountDirectoryPath([string]$WebAppURL, [string]$RestrictedOU)
{
$WebApp = Get-SPWebApplication $WebAppURL -ErrorAction SilentlyContinue
if ($WebApp -ne $Null)
{
foreach($site in $WebApp.Sites)
{
try
{
Set-SPSite -Identity $site.URL -UserAccountDirectoryPath $RestrictedOU -ErrorAction Stop
Write-Host "UserAccountDirectoryPath was set for site collection : ", $site.URL -ForegroundColor Green
}
catch
{
Write-Host "Error while setting UserAccountDirectoryPath for site collection : ", $site.URL -ForegroundColor Red
}
$site.Dispose()
}
}
else
{
Write-Host ""
Write-Host "No WebApplication found with URL", $WebAppURL -ForegroundColor Red
Write-Host ""
}
}
#########################################################################################
Write-Host ""
Write-Host "----------------------------------------------------------"
Write-Host ""
Write-Host " Site collection Configuration"
Write-Host ""
Write-Host "----------------------------------------------------------"
Write-Host ""
$keytodelete = "*ldap*"
$AccountDirectoryPath = "OU=SharePoint,DC=RBLA,DC=COM"
$Site = Read-Host "Please enter WebApplication URL"
$begindate = Get-date
#########################################################################################
$WebApp = Get-SPWebApplication $Site -ErrorAction SilentlyContinue
if ($WebApp -eq $null)
{
Write-Host ""
Write-Host "Please set WebAppURL" -ForegroundColor Red
Write-Host ""
return
}
Write-Host ""
Write-Host "Configure user account directory path on all site collections:" -ForegroundColor Yellow
Write-Host $AccountDirectoryPath -ForegroundColor Yellow
Write-Host ""
SetUserAccountDirectoryPath $Site $AccountDirectoryPath
Write-Host ""
Write-Host "Done." -ForegroundColor Green
#########################################################################################
$enddate = Get-date
$datediff= (($enddate - $begindate)).ToString()
Write-Host ""
Write-Host "------------------------------"
Write-Host ""
Write-host "Job done in $datediff min." -ForegroundColor Green
Write-Host ""
Write-Host "------------------------------"
以上是关于powershell 限制网站集的人员选择器的Active Directory路径。的主要内容,如果未能解决你的问题,请参考以下文章
过滤 (Filtering)
过滤 (Filtering)
SharePoint:如何在SharePoint 2013限制多个网站集的Search Result
Power Apps 中人员选择器的使用
Power Apps 中人员选择器的使用
Power Apps 中人员选择器的使用