Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $masterdatabase = "master"
- $webdatabase = "web"
- $root = Get-Item -Path (@{$true="$($masterdatabase):\content\home"; $false="$($masterdatabase):\content"}[(Test-Path -Path "$($masterdatabase):\content\home")])
- $props = @{
- Parameters = @(
- @{Name="root"; Title="Choose the report root"; Tooltip="Only items from this root will be returned."; }
- )
- Title = "comparison Report"
- Description = "Choose the criteria for the report."
- Width = 550
- Height = 300
- ShowHints = $true
- Icon = [regex]::Replace($PSScript.Appearance.Icon, "Office", "OfficeWhite", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
- }
- $result = Read-Variable @props
- if($result -eq "cancel") {
- exit
- }
- filter Where-comparereport {
- param(
- [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
- [Sitecore.Data.Items.Item]$item
- )
- if ($item) {
- $masteritem = $item.Versions.GetLatestVersion().Version.Number
- $webitem = [Sitecore.Data.Database]::GetDatabase("web").GetItem($item.Id)
- if($webitem){
- $webitemnumber = $webitem.Versions.GetLatestVersion().Version.Number
- if (!$masteritem.Equals($webitemnumber)) {
- $item
- }
- }
- }
- }
- $items = @($root) + @(($root.Axes.GetDescendants() | Initialize-Item)) | Where-comparereport
- if($items.Count -eq 0) {
- Show-Alert "There are no content items that is different from web and master database"
- } else {
- $props = @{
- Title = "Item versions difference Report"
- InfoTitle = "Items that the latest version on web db is different than master"
- InfoDescription = "Items that the latest version on web db is different than master"
- PageSize = 25
- }
- $items |
- Show-ListView @props -Property @{Label="Icon"; Expression={$_.__Icon} },
- @{Label="Name"; Expression={$_.DisplayName} },
- @{Label="Updated"; Expression={$_.__Updated} },
- @{Label="Updated by"; Expression={$_."__Updated by"} },
- @{Label="Created"; Expression={$_.__Created} },
- @{Label="Created by"; Expression={$_."__Created by"} },
- @{Label="Path"; Expression={$_.ItemPath} }
- }
- Close-Window
Add Comment
Please, Sign In to add comment