Skip to content

Instantly share code, notes, and snippets.

@martinrayenglish
Created March 20, 2021 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinrayenglish/11e7001eb14dba83bdc98aa702804c8a to your computer and use it in GitHub Desktop.
Save martinrayenglish/11e7001eb14dba83bdc98aa702804c8a to your computer and use it in GitHub Desktop.
$sql = @"
WITH publishoptions
AS (SELECT [id],
[jobid],
[status],
[statusmessage],
[queued],
[started],
[stopped],
[Options].value('declare namespace ns="http://schemas.datacontract.org/2004/07/Sitecore.Framework.Publishing.PublishJobQueue"; (/ns:PublishOptionsEntity/ns:ItemId)[1]',
'varchar(max)'
) AS
[ItemId],
[Options].value('declare namespace ns="http://schemas.datacontract.org/2004/07/Sitecore.Framework.Publishing.PublishJobQueue"; (/ns:PublishOptionsEntity/ns:Descendants)[1]',
'varchar(max)')
AS [Descedants],
[Options].value('declare namespace ns="http://schemas.datacontract.org/2004/07/Sitecore.Framework.Publishing.PublishJobQueue"; (/ns:PublishOptionsEntity/ns:RelatedItems)[1]',
'varchar(max)')
AS [RelatedItems],
[Options].value('declare namespace ns="http://schemas.datacontract.org/2004/07/Sitecore.Framework.Publishing.PublishJobQueue"; (/ns:PublishOptionsEntity/ns:User)[1]',
'varchar(max)')
AS
[User]
FROM [dbo].[publishing_jobqueue])
SELECT [id],
[jobid],
[status],
[statusmessage],
[queued],
[started],
[stopped],
[itemid],
[descedants],
[relateditems],
[user]
FROM publishoptions
"@
Import-Function Invoke-SqlCommand
$db = Get-Database -Name "master"
$connection = [Sitecore.Configuration.Settings]::GetConnectionString($db.Name)
$jobQueue = Invoke-SqlCommand -Connection $connection -Query $sql
$jobQueue | Show-ListView -Modal -Title "Publishing jobs in $($db.Name) database" -Property `
@{Label = "Id"; Expression = { $_.id } },
@{Label = "Jobid"; Expression = { $_.jobid } },
@{Label = "Status"; Expression = { $_.status } },
@{Label = "Statusmessage"; Expression = { $_.statusmessage } },
@{Label = "Queued"; Expression = { $_.queued } },
@{Label = "Started"; Expression = { $_.started } },
@{Label = "Stopped"; Expression = { $_.stopped } },
@{Label = "Itemid"; Expression = { $_.itemid } },
@{Label = "Descedants"; Expression = { $_.descedants } },
@{Label = "Relateditems"; Expression = { $_.relateditems } },
@{Label = "User"; Expression = { $_.user } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment