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 / Get-VariantRoots.ps1
Created Jun 16, 2019
Ret Rendering Variant Roots for all sites
View Get-VariantRoots.ps1
Set-HostProperty -HostWidth 5000
$roots = @()+[Sitecore.Sites.SiteManager]::GetSites() | ? { $_.Properties['IsSxaSite'] } | % { $_.Properties['rootPath'] };
foreach ($root in $roots) {
$site = New-Object -TypeName PSCustomObject
Add-Member -InputObject $site -Name 'path' -Value $root -MemberType NoteProperty
$variants = New-Object -TypeName PSCustomObject
Add-Member -InputObject $site -Name 'variants' -Value $variants -MemberType NoteProperty
$variantFolders = gci "master:$($root)/Presentation/Rendering Variants" | select Name, @{Name = "Path"; Expression={$_.paths.Path}}
foreach($variantFolder in $variantFolders){
@AdamNaj
AdamNaj / Find-ChattyZwaveDevices.ps1
Last active Jan 1, 2019
How to check if Z-Wave node is Secure or Plus version based on QZW Config file.
View Find-ChattyZwaveDevices.ps1
# Path to your Home Assistant shared folder - mapped drive on your windows machine
$haPath = "I:"
# Get the content of the Open Z-Wave log file
[string[]]$ozwCfg = Get-Content "$haPath\OZW_Log.txt"
#find received messqages, filter and order by number of messages
$ozwCfg | ?{ $_ -match "Detail, Node(\d\d\d), Received"} |
% { $matches[0] } |
? { $_ -match "(\d\d\d)" } |
@AdamNaj
AdamNaj / configuration.yaml
Last active Aug 24, 2019
Z Wave Graph for Home Assistant
View configuration.yaml
panel_custom:
- name: zwavegraph2
sidebar_title: Z-Wave Graph
sidebar_icon: mdi:access-point-network
url_path: zwave
@AdamNaj
AdamNaj / Get-TaggedItems.ps1
Created Nov 10, 2018
Querying Habitat Legal Site for Tags
View Get-TaggedItems.ps1
gci -path 'master:\content\Habitat sites\Habitat Legal\Home\News' |
%{ [PSCustomObject]@{ Name=&{$_.Title};
Author=&{@( $_.PSFields.Author.Items |
%{ gi master: -id $_ } |
%{ "$($_._Name) ($($_.JobTitle))" }) -join ", "};
Tags=&{@( $_.PSFields.SxaTags.Items |
%{ gi master: -id $_ } |
%{ $_.Name }) -join ", "}
} } | ft -prop @{name="Name"; width=50; Expression={$_.Name}},
@{name="Author"; width=60; Expression={$_.Author}}, Tags
@AdamNaj
AdamNaj / Import.ps1
Created Nov 7, 2018
Wordpress XML (to SXA) import script (messy output)
View Import.ps1
$xmlPath = "$AppPath\sugcon.xml"
$pageTemplate = "Project/Community/Page"
$siteHome = "master:\content\Community\SUGCON\Home"
$sitepath = "master:\content\Community\SUGCON"
[string[]]$content = get-content $xmlPath
[xml]$xml = $content
$pages = $xml.rss.channel.item | %{ [PSCustomObject]@{
@AdamNaj
AdamNaj / Clone Site.ps1
Created Jun 13, 2018
Modify SXA "Clone Site" script to be able to clone sites with Security set up on them.
View Clone Site.ps1
# Open the following item:
# /sitecore/system/Modules/PowerShell/Script Library/SXA/SXA - Multisite/Content Editor/Context Menu/Clone Site
# inside the try{ } clause wrap its content with:
New-UsingBlock(New-Object -TypeName "Sitecore.SecurityModel.SecurityDisabler"){
# all code that was inside the try clause before - goes here
}
@AdamNaj
AdamNaj / Add-ProjectSpecificComponentDatasource.ps1
Last active Sep 29, 2017
Create project specific datasource templates for your SXA tenant so you can extend them with custom fields - Promo on Showcase example
View Add-ProjectSpecificComponentDatasource.ps1
###### user settings start here
# Path to the tenant that you want to update
$tenantTemplatesPath = "master:\templates\Project\Showcase"
# Site that should be upgraded to the new template - ise asterisk to upgrade multiple sites.
$sitePath = "master:\content\Showcase\*"
# Path to the component for which you want to introduce your own data source
$componentPath = 'master:\layout\Renderings\Feature\Experience Accelerator\Page Content\Promo'
@AdamNaj
AdamNaj / Convert-EventsToSearchable.ps1
Created Sep 15, 2017
Better Events List Script - Convert SXA Events templates into searchable items
View Convert-EventsToSearchable.ps1
$tenantTemplatesPath = "master:\templates\Project\Showcase"
$sitePath = "master:\content\Showcase\int"
function Assert-FeatureTemplateInProject {
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[String[]] $TenantTemplateFolder,
[parameter(Mandatory=$true)]
@AdamNaj
AdamNaj / Add-TagToPages.ps1
Created Aug 30, 2017
Add SXA Tags to all SXA Pages
View Add-TagToPages.ps1
$sitePath = "master:\content\Demo\Origin"
#get items but only those that are SXA pages
$pages = Get-ChildItem "$sitePath\Home" -Recurse -WithParent |
Where-Object { Test-BaseTemplate -Item $_ -Template "Foundation/Experience Accelerator/Multisite/Content/Page" }
#you can pipe it to further filtering here if you want to do it only for some pages
#get tag items that contain the word "Adam" in them
$tags = (@() + (Get-ChildItem "$sitePath\Data\Tags" -Recurse |
Where-Object { Test-BaseTemplate -Item $_ -Template "Feature/Experience Accelerator/Taxonomy/Datasource/Tag" } |
@AdamNaj
AdamNaj / Set-Layout.ps1
Created Aug 30, 2017
Set a layout for a device across multiple pages
View Set-Layout.ps1
# branch that should be replaced - change the path
$items = Get-ChildItem master:\content\home2 -WithParent
# layout I want to set on my items
$layout = Get-Item 'master:\layout\Layouts\Foundation\Experience Accelerator\MVC\MVC Layout'
# Device on which I want to set it
$device = Get-LayoutDevice "Mobile"
foreach($item in $items){
You can’t perform that action at this time.