我有以下代码 它可以在SPO和OD用户上大规模启用外部共享
Connect-SPOService -Url https://######-admin.sharepoint.com
$currentSiteCollection = (Get-Content "siteCollectionsEnabled.txt")
$collectionCount = $currentSiteCollection.Count
if ($currentSiteCollection){
foreach ($currentSite in $currentSiteCollection)
{
Clear-Host
Write-Output "Enabling " $currentSite.ToString() $collectionCount.ToString() " sites left"
Set-SPOSite -Identity $currentSite -SharingCapability ExternalUserSharingOnly
Add-Content ODFBSiteSharingEnabled.log $currentSite.ToString()
$collectionCount = $collectionCount - 1
}
}
但是在跑步的时候我得到了这个 8741 遗址离开了 Set-SPOSite:无可用连接。在运行此CmdLet之前使用Connect-SPOService。 在C:### \ siteCollectionsDisabledEnable \ siteEnable.ps1:10 char:9 + Set-SPOSite -Identity $ currentSite -SharingCapability ExternalUserSharin ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:NotSpecified:(:) [Set-SPOSite],InvalidOperationException
这里有些帮助吗?答案 0 :(得分:0)
您是否可以自行运行Connect-SPOService cmdlet?你有任何错误吗?
如果它工作正常并且您可以登录,则在此处删除脚本的第一行并执行其余部分。