Skip to content

Instantly share code, notes, and snippets.

Adam Najmanowicz AdamNaj

Block or report user

Report or block AdamNaj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AdamNaj
AdamNaj / CopyOrMove-Renderings.ps1
Last active Aug 29, 2017
Copy or Move renderings from one device to another (within Shared layout)
View CopyOrMove-Renderings.ps1
#branch that should be replaced - change the path
$items = Get-ChildItem master:\content\home2 -WithParent
#Provide the names for your devices from which and to which things should be copied
$fromDevice = Get-LayoutDevice "Default"
$toDevice = Get-LayoutDevice "Mobile"
# for Final layout renderings you need to add -FinalLayout switch to the Add/Remove-Rendering cmdlets
# and provide the -Language for which you want to perform the operation
@AdamNaj
AdamNaj / Test-RenderingUsage.ps1
Created Jun 5, 2017
What Items are using my rendering?!
View Test-RenderingUsage.ps1
Get-Item 'master:\layout\Renderings\Feature\Experience Accelerator\Media\Video' | Get-ItemReferrer | Show-ListView
@AdamNaj
AdamNaj / Test-Serialization.ps1
Created Jun 5, 2017
Unicorn vs Sitecore Serialization compare
View Test-Serialization.ps1
$sitecoreSerializationPath = "C:\inetpub\wwwroot\sitecore81\Data\serialization"
$unicornSerializationPath = "C:\Projects\sitecorepowershell\Trunk\Cognifide.PowerShell\serialization"
$serializationIds = gci $sitecoreSerializationPath -filter "*.item" -recurse | Get-Content -first 3 | ? { $_.Startswith("id:") } | % { $_.Substring(5,36).ToLower() }
$unicornIds = gci $unicornSerializationPath -filter "*.yml" -recurse | Get-Content -first 2 | ? { $_.Startswith("ID:") } | % { $_.Substring(5,36) }
"$($serializationIds.Count) items in Sitecore Serialization"
"$($unicornIds.Count) items in Unicorn Serialization"
Write-Host "---- Missing in Unicorn ----"
@AdamNaj
AdamNaj / Get-UserRoles.ps1
Last active Feb 6, 2017
List Roles for User
View Get-UserRoles.ps1
function Get-UserRoles{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Identity
)
$user = Get-User $Identity
return Get-Role -Filter * | Where-Object { $_.IsMember($user,$true,$true) }
}
@AdamNaj
AdamNaj / Relink-Test.ps1
Created Oct 14, 2016
Working with Links database
View Relink-Test.ps1
@AdamNaj
AdamNaj / Export-ZGShowcase.ps1
Last active Aug 22, 2016
ZG Showcase migration
View Export-ZGShowcase.ps1
$orderNo=0
$siteDef = gci "master:\content\Showcase Group\Showcase\int\home" -Recurse |
? { $_.Name -ne "Data" -and $_.Parent.Name -ne "Data" -and $_.Parent.Parent.Name -ne "Data" -and $_.Parent.Parent.Parent.Name -ne "Data" -and $_.Parent.Name -ne "Page Data" -and $_.Visualization.Layout -ne $null} |
%{
$orderNo++;
$pageDefinition = [ordered]@{
Name="$($_.Name)";
DisplayName="$($_.DisplayName)";
@AdamNaj
AdamNaj / Get-TemplateComplexity.ps1
Created Apr 20, 2016
Template Complexity analysis
View Get-TemplateComplexity.ps1
$standardFieldCount = (Get-ItemTemplate master:\).Fields.Count
Get-ChildItem master:\templates -Recurse |
? {($_.TemplateName -eq "Template") -and -not $_.FullPath.StartsWith('/sitecore/templates/System')} |
% { [Sitecore.Data.Items.TemplateItem]$template = $_
[pscustomobject]@{
Path=&{$_.FullPath};
OnThisTemplate=&{(Get-ChildItem -Path $_.Providerpath -Recurse | ? { $_.TemplateName -eq "Template Field"}).Count};
NonStandardFields =&{$template.Fields.Count- $standardFieldCount};
TotalFields=&{$template.Fields.Count}
You can’t perform that action at this time.