Created
March 12, 2023 02:58
-
-
Save MartinMiles/401773c36f8c1f4d58f53799e8d0ff9a to your computer and use it in GitHub Desktop.
SPE snipped to return items from MASTER database of my XM Cloud instance
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
$sql = @" | |
USE [{0}] | |
SELECT ID, [Name], [TemplateID], Created from [dbo].[Items] | |
"@ | |
Import-Function Invoke-SqlCommand | |
Write-Verbose "Cleaning up the History, EventQueue, and PublishQueue tables in the $($db.Name) database." | |
$connection = [Sitecore.Configuration.Settings]::GetConnectionString("master") | |
$builder = New-Object System.Data.SqlClient.SqlConnectionStringBuilder $connection | |
$dbName = $builder.InitialCatalog | |
$query = [string]::Format($sql, $dbName) | |
Invoke-SqlCommand -Connection $connection -Query $query |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment