View change_image_field.ps1
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
#item I want to set the field on | |
$item = get-item "master:/content/home" | |
#image I want to use | |
$image = new-object -TypeName "Sitecore.Data.Items.MediaItem" -ArgumentList (get-item "master:/media library/Showcase/cognifide_logo") | |
#field I want to set on $item | |
$imageField = [Sitecore.Data.Fields.ImageField]$item.Fields["image"]; | |
$item.Editing.BeginEdit(); |
View new_update_image_field.ps1
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
$item = get-item master:/content/home | |
$item.Image = get-item "master:/media library/Showcase/cognifide_logo" |
View rendering_playground.ps1
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
Import-Function Resolve-Error | |
#Show-FieldEditor -Item (gi master:\content\cognifidecom\int\settings) -PreserveSections -Width 500 -Height 500 -title "Zen Garden Site settings" | |
$content = gi master:\layout\Sublayouts\ZenGarden\Basic\Content | New-Rendering -Placeholder "main" | |
$item = gi master:\content\Demo\Int\Home | |
<#Add-Rendering -Item $item -PlaceHolder "main" -Rendering $content -Parameter @{ FieldName = "Content" } | |
Add-Rendering -Item $item -PlaceHolder "main" -Rendering $content -Parameter @{ FieldName = "SummaryText" } | |
Add-Rendering -Item $item -PlaceHolder "main" -Rendering $content -Parameter @{ FieldName = "SummaryIcon" } | |
#> | |
#$renderings = $item | Get-Rendering -Placeholder "main" | |
foreach ($rendering in $Renderings) |
View CreateMissingDocFiles.ps1
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
$DocumentationFolder = "C:\Projects\sitecorepowershell\Trunk\Documentation" | |
$documented = Get-ChildItem $DocumentationFolder | % { $_.BaseName } | |
$undocumented = get-command | ? { $_.DLL -match "Cognifide"} | ? { "$($_.Verb)-$($_.Noun)" -Notin $documented } | %{ "$($_.Verb)-$($_.Noun)" } | |
$undocumented | % { | |
$fileName = "$DocumentationFolder\$_.TODO.ps1" | |
if(Test-Path $fileName){ | |
remove-item $filename | |
} |
View install_package.ps1
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
# Clear test items: | |
# Get-ChildItem 'master:\system\Modules\PowerShell\Script Library' -recurse | Where-Object { ($_.Name -match '\(test\)') } | Remove-Item | |
$package = new-package "Sitecore PowerShell Extensions"; | |
$package.Sources.Clear(); | |
$package.Metadata.Author = "Adam Najmanowicz - Cognifide, Michael West"; | |
$package.Metadata.Publisher = "Cognifide Limited"; | |
$package.Metadata.Version = "2.6"; | |
$package.Metadata.Readme = 'This module provides 2 immediately usable interfaces |
View serialize_spe.ps1
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
# Item templates | |
Get-Item 'master:\templates\Modules\PowerShell Console' | Serialize-Item -Recurse | |
Get-Item 'core:\templates\Modules\PowerShell Console' | Serialize-Item -Recurse | |
# Module Root | |
Get-Item 'master:\system\Modules\PowerShell' | Serialize-Item | |
Get-Item 'core:\system\Modules\PowerShell' | Serialize-Item | |
# Colors | |
Get-Item 'master:\system\Modules\PowerShell\Console Colors' | Serialize-Item -Recurse |
View get-psecommandshelp.ps1
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
$items = Get-Command * -CommandType Cmdlet | ? {$_.ModuleName -eq "" } | %{ Get-Help -Name ($_.Name) } | sort-object name | |
$props = @{ | |
InfoTitle = "Sitecore PowerShell Commands" | |
InfoDescription = "Lists the sitecore power shell commands" | |
PageSize = 25 | |
} | |
$items | Show-ListView @props -Property @{Label="Name"; Expression={$_.Name} }, @{Label="Synopsis"; Expression={$_.Synopsis} } |
View Available-Fields.ps1
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
Find-Item -Index sitecore_master_index ` | |
-Criteria @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/system/modules/PowerShell/" } ` | |
-First 1 | | |
select -expand "Fields" |
View Test-WhatIf.ps1
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
$item = get-item master:\content\Home\ | |
$device = Get-LayoutDevice -Default | |
$layout = Get-Item "master:\layout\Layouts\Sample Layout" | |
$contentDataSource = get-item master:\content\home | |
$rendering = New-Rendering -Path "master:\layout\Renderings\Sample\Sample Rendering" | |
$renderingItem = Get-Item -Path "master:\layout\Renderings\Sample\Sample Rendering" | |
$blog = gi "master:/content/Home/blog"; | |
$state = $blog | %{ $_."__Workflow state" } | |
New-ItemWorkflowEvent -Item $blog -Text "sdfasfd asdf sad fas" -OldState $state -NewState $state -WhatIf |
View ZGReleaseValidator.ps1
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
$registered = [ordered]@{}; | |
function Get-AttributeValue($attribute, $default){ | |
@{$true="$default";$false=$attribute}[[string]::IsNullOrEmpty($attribute)]; | |
} | |
function Is-Excluded($item, $excluded){ | |
if($excluded.ContainsKey($item.Paths.Path)){ | |
Write-Host "Excluded item: $($item.ProviderPath)" -ForegroundColor DarkCyan; | |
return $true; |
OlderNewer