This file contains hidden or 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
| #Include all paths you do not want to analyse below | |
| $protectedPaths = @( | |
| "/sitecore/media library/System/", | |
| "/sitecore/media library/Experience Explorer" | |
| "/sitecore/media library/Images/Social" | |
| ); | |
| #Include all item templates you want to ignore in the array below | |
| $protectedTemplates = @( | |
| [Sitecore.TemplateIDs]::MediaFolder |
This file contains hidden or 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
| $testPath = "master:\content\item-test" | |
| $targetLang = "pl-PL" | |
| $format = @{Property = @("ID", "Name", "Language", "Version", "Text"); AutoSize=$true } | |
| $giParams = @{Path=$testPath; Version="*"; } | |
| Set-HostProperty -HostWidth 180 | |
| & { | |
| if(Test-Path $testPath){ | |
| Remove-Item $testPath -Force -Recurse | |
| } |
This file contains hidden or 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 | |
| $items = Get-ChildItem master:\ | |
| $int = 1337 | |
| $float = 13.37 | |
| $bool = $true | |
| $date = Get-Date | |
| $string = "A string value" | |
| $user = Get-User "sitecore\admin" | |
| $table = @{"Name" = "Sitecore PowerShell"; "Date" = [datetime]::Now} | |
| $list = @("Sitecore","PowerShell", [datetime]::now) |
This file contains hidden or 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 Remove-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 hidden or 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 Publish-Workaround { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Position = 0,Mandatory = $true,ValueFromPipeline = $true)] | |
| [ValidateNotNullOrEmpty()] | |
| [Sitecore.Data.Items.Item]$item, | |
| [Parameter(Position = 1,Mandatory = $true,ValueFromPipeline = $true)] | |
| [ValidateNotNullOrEmpty()] | |
| [Sitecore.Data.Database]$target | |
| ) |
This file contains hidden or 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 Set-ItemFieldToExternalLink{ | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] | |
| [ValidateNotNullOrEmpty()] | |
| [Sitecore.Data.Items.Item]$Item, | |
| [Parameter(Position=1, Mandatory=$true)] | |
| [ValidateNotNullOrEmpty()] | |
| [string]$FieldName, |
This file contains hidden or 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
| $days = 7; | |
| Get-ChildItem master:\content\home -Recurse | | |
| ? { $_."__updated" -gt (Get-Date).AddDays(-$days) } | | |
| Format-Table -Property ID, Name, "__updated", "__updated by" |
This file contains hidden or 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
| Get-childitem "master:/media library/Showcase-Group/search/int/images/cars" -rec | | |
| ? { $_."File Path" -ne $null } | | |
| % { $_."File Path" = $_."File Path" -replace "/Replicated", "" } |
This file contains hidden or 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) |