Removing all broken inhertiance and permissions complete site collection

Problem Description:

if you need to remove all permissions and broken inheritances from a complete site collection, you may run this script​

Resolution:

Add-PSSnapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite https://URL
$webs = $site.AllWebs
foreach ($web in $webs){
if ( ($web.HasUniqueRoleAssignments) -and ($web.IsRootWeb -eq $false ) ){
$web.ResetRoleInheritance()}
Write-Host “Removed broken inheritance on web: ” $web.Url -ForegroundColor Red
}

$lists=$web.Lists
foreach ($list in $lists){
if (($list -ne $null) -and ($list.HasUniqueRoleAssignments)){
$list.ResetRoleInheritance()
Write-Host “Removed broken inheritance on list: ” $list.Title -ForegroundColor Blue
Clear-Variable list
}

Write-Host “Entering list to remove single item permission: ” $list.Title
$items = $list.items | Where {$_.HasUniqueRoleAssignments}
foreach ($item in $items){
$item.ResetRoleInheritance()
Write-Host “Removed broken inheritance on item: ” $item.Name -ForegroundColor Green
Clear-Variable item
}}
$web.Dispose()
}

Remove all permissions
$groups = $web.SiteGroups
for ($i=0;$i -le $groups.Count;$i++){
$web.SiteGroups.Remove($groups[$i])
}
$users = Get-SPUser -Web $web -Limit all
for ($i=0;$i -le $users.Count;$i++){
Remove-SPUser -Web $web -Identity $users[$i] -Confirm:$false
}

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How to terminate SharePoint 2013 Designer Workflow on PowerShell

Problem Description:

SharePoint Designer Workflows in version 2013 couldn’t be terminated on the GUI because they were in an undefined state​

Resolution:

​$web=get-spweb https://URL
$list=$web.lists[“ListName”]
$wfm=New-Object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($list.ParenWeb)
$wfm.GetWorkflowInstanceService()
$wfs=$wfi.EnumerateInstancesForListItem($list.ID,”$itemID”)
$wfi.TerminateWorkflow($wfs[0])

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Reporting Subscriptions stucks in status “Pending” after domain user migration

Problem Description:

after a user’s account has been migrated from sourdeomain to targetdomain, the subscriptions created with that user account stopped working.​

Resolution:

stsadm migration on SharePoint doesn’t fix this problem; you have to manually change the subscription users in the database of the SharePoint Reporting service application.

To identify:

​SELECT
jobs.name AS JobName,
C.path AS ReportPath,
C.name AS ReportName,
u.username AS SubscriptionOwner
FROM dbo.ReportSchedule RS
JOIN msdb.dbo.sysjobs jobs
ON CONVERT(varchar(36), RS.ScheduleID) = jobs.name
INNER JOIN dbo.Subscriptions S
ON RS.SubscriptionID = S.SubscriptionID
INNER JOIN dbo.Catalog C
ON s.report_oid = C.itemid
INNER JOIN dbo.users u
ON s.ownerid = u.userid

To fix:

DECLARE @OldUserID uniqueidentifier
DECLARE @NewUserID uniqueidentifier
SELECT @OldUserID = UserID FROM dbo.Users WHERE UserName = ‘sourcdomain\firstname.lastname’
SELECT @NewUserID = UserID FROM dbo.Users WHERE UserName = ‘targetdomain\firstname.lastname’
UPDATE dbo.Subscriptions SET OwnerID = @NewUserID WHERE OwnerID = @OldUserID

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Meine Wiederladedaten 9mm Luger

Liebe Leute,

wenn man da bei Null anfängt und sich im Web schlau zu lesen versucht, bekommt man fast Kopfweh. Meinungen über Meinungen, die unterschiedlicher nicht sein könnten.

Darum stelle ich hier meine Daten einfach mal zur Verfügung.
Für alle diejenigen, die einfach mal loslegen wollen.
Verwende diese Laborierungen auf 25m, da passt alles wunderbar.

Pulver: 3.8 gn Vihtavuori N320
Geschoss: LOS RN 123 gn .356
Zünder: S&B Small Pistol
Länge: 29.70 mm

…funzt wunderbar mit der Glock sowie mit der X-Six!

Hier gehts zu meiner .38 Special Laborierung

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.25 out of 5)
Loading...

Cannot rename SPSite on restore (Restore-SPSite)

Problem Description:

when restoring a SPSite from a backup to a new URL (longer), it didn’t work.

Cause: for the new URL there would have been documents exceeding the 256 character URL limit​

Resolution:

detach SQL database
find documents
re-attach and manually correct them

USE SPC_Content_MyShared_01
declare @siteid as UniqueIdentifier
set @siteid = ‘1cc13ce’
select *
FROM
TVF_AllDocs_Site(@siteID)
WHERE
LEN(CASE WHEN (DATALENGTH(DirName) = 0) THEN LeafName WHEN (DATALENGTH(LeafName) = 0) THEN DirName ELSE DirName + N’/’ + LeafName END) > 256

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...