This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) } | |
} |


This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming Sitecore PowerShell Extensions 4.2 or newer is installed | |
# Assuming your Home has an "Image" field of type "Image" | |
# Assuming you have second item next to Home called Home2 that has an "Image" field of type "Image" | |
$coverImage = Get-Item 'master:\media library\Default Website\cover' | |
$scLogoImage = Get-item 'master:\media library\Default Website\sc_logo' | |
function Get-HomeItem { Get-item master:\content\home } | |
function Get-HomeChildItem { Get-item master:\content\Home\child } | |
function Get-Home2Item { Get-item master:\content\home2 } | |
function Set-CoverImage { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Extracts the compressed file to to the specified directory. | |
.PARAMETER Item | |
Specifies the item to be exported as PDF/JPG/PNG. | |
.EXAMPLE | |
The following eports the Home page by piping an item into the cmdlet. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Archive-OldItemVersion { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0,Mandatory = $true,ValueFromPipeline = $true)] | |
[ValidateNotNullOrEmpty()] | |
[Sitecore.Data.Items.Item]$Item, | |
[Parameter(Position = 1,Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[int]$MaxVersions | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Cognifide.PowerShell.Core.Modules.ModuleManager]::GetFeatureRoots([Cognifide.PowerShell.Core.Modules.IntegrationPoints]::FunctionsFeature) | | |
Initialize-Item | | |
%{ $_.ProviderPath } | | |
%{ Get-ChildItem -Path $_ } | | |
?{ $_.TemplateName -eq "PowerShell Script" } | | |
ft Database, Name, @{Label="Parent"; Expression={ $_.Parent.Name}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cmds = Get-Command -CommandType Cmdlet #| select -ExpandProperty Parameters #| #| ft name, count #-Property # % { $_.Keys } | Sort -Unique | |
#$cmds[733].Name | |
#$cmds[733].Parameters | gm | |
$parameters = [ordered]@{}; | |
$cmds | % { | |
if($_.Parameters.Keys.Count -gt 0){ | |
foreach($param in $_.Parameters.Keys){ | |
if($param -ne $null -and -not $parameters.Contains($param)){ | |
$parameters.Add($param, $_.Name) | |
} else { |