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
$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 ----" |
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
#Host Color test | |
$Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'White') | |
$Host.UI.RawUI.ForegroundColor = 'Black' | |
$Host.PrivateData.ErrorForegroundColor = 'Red' | |
$Host.PrivateData.ErrorBackgroundColor = $bckgrnd | |
$Host.PrivateData.WarningForegroundColor = 'Magenta' | |
$Host.PrivateData.WarningBackgroundColor = $bckgrnd | |
$Host.PrivateData.DebugForegroundColor = 'Blue' | |
$Host.PrivateData.DebugBackgroundColor = $bckgrnd | |
$Host.PrivateData.VerboseForegroundColor = 'Green' |
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
function New-MediaItem{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$filePath, | |
[Parameter(Position=1, Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$mediaPath) |