#region AboutMe
####################################################################################################
# ABOUT: Restore Permissions on an OneDrive Site by adding the admin account as Site Coll Admin
# ParametersInput: User account and OneDrive Url
#
# Date: 19/Sep/2019
# Author: Jaqueline Goncalves
####################################################################################################
#endregion AboutMe
#region Variables
$env = "Company'sEnvironmentName"
$config = @{
siteAdminUrl = "https://$($env)-admin.sharepoint.com"
}
#endregion Variables
Function Add-SiteCollectionAdministrator{
Param(
$siteAdminUrl,
$siteColUrl,
$siteColAdminUser
)
Update-SiteCollectionAdministrator -siteAdminUrl $siteAdminUrl -siteColUrl $siteColUrl
-siteColAdminUser $siteColAdminUser -isSiteColAdmin:$true
}
Function Remove-SiteCollectionAdministrator{
Param(
$siteAdminUrl,
$siteColUrl,
$siteColAdminUser
)
Update-SiteCollectionAdministrator -siteAdminUrl $siteAdminUrl -siteColUrl $siteColUrl
-siteColAdminUser $siteColAdminUser -isSiteColAdmin:$false
}
## Internal Function
Function Update-SiteCollectionAdministrator{
Param(
$siteAdminUrl,
$siteColUrl,
$siteColAdminUser,
[bool]
$isSiteColAdmin
)
## Check Connection
Try{
$siteCheck = Get-SPOSite $siteAdminUrl
}
Catch{
Connect-SPOService -Url $siteAdminUrl
}
$updateSiteAdmin = Set-SPOUser -Site $siteColUrl -LoginName $siteColAdminUser
-IsSiteCollectionAdmin $isSiteColAdmin
if($updateSiteAdmin){
write-host "$($siteColUrl) \>" -NoNewline -ForegroundColor Gray
write-host " Is " -NoNewline
write-host "$($updateSiteAdmin.DisplayName) " -NoNewline -ForegroundColor Green
write-host "Site Coll Admin?" -NoNewline
switch($isSiteColAdmin){
$true{
write-host " $($isSiteColAdmin)." -ForegroundColor Green
}
$false{
write-host " $($isSiteColAdmin)." -ForegroundColor Yellow
}
}
}
}
## Example:
$properties = @{userAccount = "someemailaddress@domain.onmicrosoft.com"
userOneDrive = "https://$($env).sharepoint.com/sites/OneDriveIssue"}
$user = New-Object PSObject -Property $properties
Add-SiteCollectionAdministrator -siteAdminUrl $config['siteAdminUrl']
-siteColUrl $user.userOneDrive -siteColAdminUser $user.userAccount
Disconnect-SPOService
Friday, 25 October 2019
Update Site Collection Administrator
Handy script that can be used for removing or adding a Site Collection Administrator.
Tuesday, 22 October 2019
TypeError: Unable to get property 'replace' of undefined or null referenceTypeError: Unable to get property '_events' of undefined or null reference
We ran into an issue where a SharePoint 2013 farm was upgraded and after the upgrade the Managed Metadata Service wasn't running correctly for a while.
After investigation and lots of reading, I came across many people reporting that it was a permission issue.
Initially the error we were getting was:
(The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please contact your administrator).
In ULS, the error was:
Failed to get term store during cache check for changes. Proxy 'Managed Metadata Service'. Exception: System.Security.SecurityException: Requested registry access is not allowed.
There was also another error reported on workflows that could not be completed:
Error from ULS: Failed to load product component ifsFileNames.xml. Web virtual root may be installed improperly.
The two references below were the key for the resolution of the problems in the environment:
“6616 Critical Requested registry access is not allowed.”
Chadd Talks | INFOPATH – REQUESTED REGISTRY ACCESS IS NOT ALLOWED – EVENT ID 6616 / 5369
MSDN | Requested registry access is not allowed when opening Infopath Forms on Sharepoint 2013
"psconfig -cmd secureresources" command had to be run on all the servers.
Once this was run on the server where Managed Metadata was inaccessible, this particular issue was resolved. Just be aware that this command can perform IIS reset on the server which will cause some down time if this is a web front end server.
Once this issue was resolved though, users started to report a new error while trying to access a list which was grouped by a Metadata column.
Many resources suggested that if the problem was global across the environment and lists, this was likely related to updates and further updates and KB would need to be installed.
Luckily, this time this wasn't necessary. The issue didn't seem to be affecting other lists and it was affecting just the view which was grouped by the Metadata column which was a good hint.
Having a closer look in PowerShell, I could see that the issue was because one of the items didn't have any value assigned to it, which was very likely caused because of the other issue mentioned here. Once some value was assigned to that particular item, the issue was resolved.
Initially the error we were getting was:
(The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please contact your administrator).
In ULS, the error was:
Failed to get term store during cache check for changes. Proxy 'Managed Metadata Service'. Exception: System.Security.SecurityException: Requested registry access is not allowed.
There was also another error reported on workflows that could not be completed:
Error from ULS: Failed to load product component ifsFileNames.xml. Web virtual root may be installed improperly.
The two references below were the key for the resolution of the problems in the environment:
“6616 Critical Requested registry access is not allowed.”
Chadd Talks | INFOPATH – REQUESTED REGISTRY ACCESS IS NOT ALLOWED – EVENT ID 6616 / 5369
MSDN | Requested registry access is not allowed when opening Infopath Forms on Sharepoint 2013
"psconfig -cmd secureresources" command had to be run on all the servers.
Once this was run on the server where Managed Metadata was inaccessible, this particular issue was resolved. Just be aware that this command can perform IIS reset on the server which will cause some down time if this is a web front end server.
Once this issue was resolved though, users started to report a new error while trying to access a list which was grouped by a Metadata column.
Many resources suggested that if the problem was global across the environment and lists, this was likely related to updates and further updates and KB would need to be installed.
Luckily, this time this wasn't necessary. The issue didn't seem to be affecting other lists and it was affecting just the view which was grouped by the Metadata column which was a good hint.
Having a closer look in PowerShell, I could see that the issue was because one of the items didn't have any value assigned to it, which was very likely caused because of the other issue mentioned here. Once some value was assigned to that particular item, the issue was resolved.
Subscribe to:
Comments (Atom)