Category: Sharepoint

Hi, When You migrate from a local fileshare, You will have a problem with recursive permissions from parent object. Here is script that can scan thru large library (5000+ items) and reset recursive permissions to them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
function Restore-SPOListAllItemsInheritance { param ( [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] [string]$Url, [Parameter(Mandatory=$true,Position=3)] [SecureString]$AdminPassword, [Parameter(Mandatory=$true,Position=4)] [string]$ListTitle ) $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) $ctx.Load($ctx.Web.Lists) $ctx.Load($ctx.Web) $ctx.Load($ctx.Web.Webs) $ctx.ExecuteQuery() $ll=$ctx.Web.Lists.GetByTitle($ListTitle) $ctx.Load($ll) $ctx.ExecuteQuery() ## View XML $qCommand = @" <View Scope="RecursiveAll"> <Query> <OrderBy><FieldRef Name='ID' Ascending='TRUE'/></OrderBy> </Query> <RowLimit Paged="TRUE">5000</RowLimit> </View> "@ ## Page Position $position = $null ## All Items $allItems = @() Do{ $camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery $camlQuery.ListItemCollectionPosition = $position $camlQuery.ViewXml = $qCommand ## Executing the query $currentCollection = $ll.GetItems($camlQuery) $ctx.Load($currentCollection) $ctx.ExecuteQuery() ## Getting the position of the previous page $position = $currentCollection.ListItemCollectionPosition # Adding current collection to the allItems collection $allItems += $currentCollection Write-Host "Collecting items. Current number of items: " $allItems.Count } while($position -ne $null) Write-Host "Total number of items: " $allItems.Count for($j=0;$j -lt $allItems.Count ;$j++) { Write-Host "Resetting permissions for " $allItems[$j]["Title"] ".." $allItems[$j]["FileRef"] $allItems[$j].ResetRoleInheritance() $ctx.ExecuteQuery() } } # Paths to SDK. Please verify location on your computer. Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Enter the data $AdminPassword=Read-Host -Prompt "Enter password" -AsSecureString $username="user@tenant.onmicrosoft.com" $Url="https://tenant.sharepoint.com" $ListTitle="library or list" Restore-SPOListAllItemsInheritance -Username $username -Url $Url -AdminPassword $AdminPassword -ListTitle $ListTitle |
Orginal source for…

Hi, Today I found this excellent script for the job. All the credit goes to http://jasonwarren.ca/clearspconfigcache/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
<# .SYNOPSIS Clear the Configuration Cache in a SharePoint 2010, 2013, or 2016 farm .DESCRIPTION Clear-SPConfigCache.ps1 will: 1. Stop the SharePoint Timer Service on all servers in the farm 2. Delete all xml files in the configuration cache folder on all servers in the farm 3. Copy the existing cache.ini files as a backup 4. Clear the cache.ini files and reset them to a value of 1 5. Start the SharePoint Timer Service on all servers in the farm Clear-SPConfigCache.ps1 will work in either single-server and multi-server farms. Run in an elevated SharePoint Management Shell Author: Jason Warren .LINK http://jasonwarren.ca/ClearSPConfigCache ClearSPConfigCache.ps1 .EXAMPLE .\Clear-SPConfigCache.ps1 .INPUTS None. Clear-SPConfigCache.ps1 does not take any input. .OUTPUTS Text output that describes the current task being performed. #> Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction Stop $farm = Get-SPFarm $ConfigDB = Get-SPDatabase | where {$_.Name -eq $Farm.Name} # Configuration Cache is stored in %PROGRAMDATA\Microsoft\SharePoint\Config\[Config ID GUID] # %PROGRAMDATA% is C:\ProgramData by default, it is assumed it's in the same location on all servers in the farm # i.e. if it's X:\ProgramData on one server, it will be X:\ProgramData on the others # We'll be connecting via UNC paths, so we'll also change the returned DRIVE: to DRIVE$ $ConfigPath = "$(($env:PROGRAMDATA).Replace(':','$'))\Microsoft\SharePoint\Config\$($ConfigDB.Id.Guid)" # Stop the timer service on all farm servers $TimerServiceName = "SPTimerV4" foreach ($server in $farm.TimerService.Instances.Server) { Write-Output "Stopping $TimerServiceName on $($server.Address)..." $service = Get-Service -ComputerName $server.Address -Name $TimerServiceName Stop-Service -InputObject $service -Verbose } # Foreach server $TimeStamp = Get-Date -Format "yyyymmddhhmmssms" # Clear and reset the cache on each server in the farm foreach ($server in $farm.TimerService.Instances.Server) { Write-Output $server.Address # build the UNC path e.g. \\server\X$\ProgramData\Microsoft\SharePoint\Config\00000000-0000-0000-0000-000000000000 $ServerConfigPath = "\\$($server.Address)\$($ConfigPath)" # Delete the XML files Write-Output "Remove XML files: $ServerConfigPath..." Remove-Item -Path "$ServerConfigPath\*.xml" # Backup the old cache.ini Write-Output "Backup $ServerConfigPath\cache.ini..." Copy-Item -Path "$ServerConfigPath\cache.ini" -Destination "$ServerConfigPath\cache.ini.$TimeStamp" # Save the value of "1" to cache.ini Write-Output "Set cache.ini to '1'..." "1" | Out-File -PSPath "$ServerConfigPath\cache.ini" Write-Output "" } #foreach server #Start the timer service on all farm servers foreach ($server in $farm.TimerService.Instances.Server) { Write-Output "Starting $TimerServiceName on $($server.Address)..." $service = Get-Service -ComputerName $server.Address -Name $TimerServiceName Start-Service -InputObject $service -Verbose } |

Sharepoint gathers usage and health data to database called WSS_Logging. By Default retention period is 14 days. If You want to make it lower, lets say 2 days use the below oneliner for it.
1 |
Get-SPUsageDefinition | Set-SPUsageDefinition -DaysRetained 2 |
And then just a quick…

Jos Lieben wrote a really complex script for automating Onedrive For Business provisioning. O365Migrator We have tested it and it works great. It has the following features. We have tested this script and it really works. Here You can download the…

I wont write on article on this because I found an excellent ready one. But the situation is that you have to move sharepoint to a different server keeping the sql-server instance name as is. http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=255 Thanks Todd!

Today I had to migrate an old wss 3.0 site to Sql 2012 R2. Made backup of the old DB and transfered it to the new server. Then restored it and tried. STSADM –o addcontentdb –url http://ssps001:7242 -databasename _wss_content_old -databaseserver…

Hi again, Today I got in the middle of a problem. CRM client told me: But at the same time Web interface was working correctly. After some investigation i found that CRM for Outlook version have been updated to…