目前我有这个脚本:
$SiteURL="https://contoso.sharepoint.com/sites/contoso"
$UserID="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4822662c272d082b27263c273b27662624" rel="noreferrer noopener nofollow">[email protected]</a>"
#Get Credentials to connect
$Cred = Get-Credential
#Connect to SharePoint Online Admin Site
Connect-SPOService -Url $AdminSiteURL -Credential $cred
#sharepoint online powershell remove user permissions from site collection
Get-SPOUser -Site $SiteURL -LoginName $UserID
但我有多个网站集,需要在其中找到该用户:
https://contoso.sharepoint.com/sites/Projecten
https://contoso.sharepoint.com/sites/PFO
如何使用 for
循环执行此操作,以便在每个网站集中找到用户?
最佳答案
已经弄清楚了:
$UserID="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c06420803092c0f030218031f03420200" rel="noreferrer noopener nofollow">[email protected]</a>"
$sitecollectios = @("https://contoso.sharepoint.com/sites/Extranet","https://contoso.sharepoint.com/sites/contoso","https://contoso.sharepoint.com/sites/Projecten","https://contoso.sharepoint.com/sites/PFO","https://contoso.sharepoint.com/sites/beheer","https://contoso.sharepoint.com/sites/Intranet")
#Get Credentials to connect
$Cred = Get-Credential
#Connect to SharePoint Online Admin Site
Connect-SPOService -Url $AdminSiteURL -Credential $cred
foreach ($collectie in $sitecollectios)
{
Get-SPOUser -Site $collectie -LoginName $UserID
}
关于powershell - 循环访问多个 SharePoint 网站集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60967552/