We recently had two Tridion Developer Summits - one on SDL Connect 2019 and one in Amsterdam this week. On both occasions I more or less used the same two demo scenarios. The slides of SDL Connect 2019 Developer Day can be retrieved over https://www.sdl.com/event/sdl-connect/san-francisco/sessions.html, then select Developer Day at the top and at the bottom you'll find Reducing Deployment Effort and Automating Business Processes with SDL Tridion Docs. (I think you'll have to pass you email, but if you were on the conference we already have that anyway )

This post will hold the source code of the ISHRemote Recipe script sample I demonstrated. Also the slides hold the ISHRemote samples with some tips and tricks and expected outcome.

Note that ISHRemote source code and documentation is on https://github.com/sdl/ISHRemote/ There are also previous webinars like https://community.sdl.com/product-groups/sdl-tridion-dx/tridion-docs/b/weblog/posts/automating-tasks-in-sdl-tridion-docs-using-powershell

#
# Administrator's Upgrade
#
# Setup, taking a backup copy of all Xml-based settings
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer
$settingsFolderPath = 'C:\temp\Demo'
Write-Verbose "Saving in $settingsFolderPath"
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLInboxConfiguration.xml"
Get-IshSetting -FieldName "FINBOXCONFIGURATION" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLBackgroundTaskConfiguration.xml"
Get-IshSetting -FieldName "FISHBACKGROUNDTASKCONFIG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLChangeTrackerConfig.xml"
Get-IshSetting -FieldName "FISHCHANGETRACKERCONFIG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLExtensionConfiguration.xml"
Get-IshSetting -FieldName "FISHEXTENSIONCONFIG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLPluginConfig.xml"
Get-IshSetting -FieldName "FISHPLUGINCONFIGXML" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLStatusConfiguration.xml"
Get-IshSetting -FieldName "FSTATECONFIGURATION" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLTranslationConfiguration.xml"
Get-IshSetting -FieldName "FTRANSLATIONCONFIGURATION" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLWriteObjPluginConfig.xml"
Get-IshSetting -FieldName "FISHWRITEOBJPLUGINCFG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLPublishPluginConfiguration.xml"
Get-IshSetting -FieldName "FISHPUBLISHPLUGINCONFIG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLCollectiveSpacesConfiguration.xml"
Get-IshSetting -FieldName "FISHCOLLECTIVESPACESCFG" -FilePath $filePath
Write-Host "Done, see $settingsFolderPath"

# Submitting my customized Xml Settings
$settingsFolderPath = 'C:\IShCD\20190924.CD.InfoShare.14.0.3105.0.SDLDOC\CustomerSpecificFiles\FilesToCopy\Websites\Author\EnterViaUI'
Write-Verbose "Submitting Xml Settings from $settingsFolderPath"
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLInboxConfiguration.xml"
Set-IshSetting -FieldName "FINBOXCONFIGURATION" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLBackgroundTaskConfiguration.xml"
Set-IshSetting -FieldName "FISHBACKGROUNDTASKCONFIG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLStatusConfiguration.xml"
Set-IshSetting -FieldName "FSTATECONFIGURATION" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLTranslationConfiguration.xml"
Set-IshSetting -FieldName "FTRANSLATIONCONFIGURATION" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLWriteObjPluginConfig.xml"
Set-IshSetting -FieldName "FISHWRITEOBJPLUGINCFG" -FilePath $filePath
$filePath = Join-Path -Path $settingsFolderPath -ChildPath "Admin.XMLPublishPluginConfiguration.xml"
Set-IshSetting -FieldName "FISHPUBLISHPLUGINCONFIG" -FilePath $filePath
Write-Host "Done"


#
# What is configured regarding Card and Fields
#
# Retrieve dynamic type and field setup over web services
Get-IshTypeFieldDefinition | Out-GridView

# Retrieve List-Of-Values, allowed dropdown values
Get-IshLovValue -LovId @("DLANGUAGE","DILLUSTRATIONTYPE", "DSTATUS")

# List all fields linked to a List Of Values (CMS managed permitted values), and show their values
$allIShLovFields = Get-IshTypeFieldDefinition | Where-Object -Property DataType -EQ -Value IshLov
Get-IshLovValue -LovId ($allIShLovFields).ReferenceLov | Out-GridView

# List all allowed Electronic Document Types
Find-IshEDT

# List all allowed OutputFormats
Find-IshOutputFormat




#
# Cancel a selection of PublicationOutputs
#
# Setup, making sure something is pending
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer #-IgnoreSslPolicyErrors
Publish-IshPublicationOutput -LogicalId GUID-8BDFFB06-C520-464D-8BBF-D855D9D6A003 -Version 2.1.1 -OutputFormat CHM -LanguageCombination en-us # making sure something is pending

# Filtering on pending publish operations, manual selection and then Cancel them
# Get-IshLovValue -LovId (Get-IshTypeFieldDefinition | where Name -eq FISHPUBSTATUS).ReferenceLov
$metadataFilter = Set-IshMetadataFilterField -Name FISHPUBSTATUS -Level Lng -ValueType Element -FilterOperator Equal -Value VPUBSTATUSPUBLISHPENDING
Find-IshPublicationOutput -MetadataFilter $metadataFilter |
Out-GridView -OutputMode Multiple -Title "Select one or more entries to Cancel publishing on" |
Stop-IshPublicationOutput




#
# Publish and Download PublicationOutputs
#
# Setup, making sure the publish message is getting handled
# For debugging/progress: Start C:\InfoShare\AppSDLDOC\BackgroundTask\Configuration\StartConsole.bat
$ishSession = New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer
$ishObject = Publish-IshPublicationOutput -LogicalId "GUID-45A7C3D9-6DC8-4EAC-8560-ECF6411A1E20" -Version 8 -OutputFormat "CHM" -LanguageCombination "en-us"
#Stop-IshPublicationOutput -LogicalId "GUID-45A7C3D9-6DC8-4EAC-8560-ECF6411A1E20" -Version 8 -OutputFormat "CHM" -LanguageCombination "en-us"

# Downloading the one we published
Get-IshPublicationOutputData -IshObject $ishObject -FolderPath "C:\TEMP\Demo\"

# Downloading multiple, all CHM files across versions of the same publication
$metadataFilter = Set-IshMetadataFilterField -Name FISHOUTPUTFORMATREF -Level Lng -FilterOperator Equal -Value CHM
Get-IshPublicationOutput -LogicalId "GUID-45A7C3D9-6DC8-4EAC-8560-ECF6411A1E20" -MetadataFilter $metadataFilter |
Get-IshPublicationOutputData -FolderPath "C:\TEMP\Demo\"




#
# Monitoring Background Tasks
#
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer
# A view on the virtual queues of the centralized CMS' queuing system, showing the last 24 hours
Get-IShBackgroundTask

# A view on the centralized logging of Background Tasks, showing the last 24 hours
Get-IshEvent




#
# Monitoring the Environment, for Performance hint GitHub's ISHMeasure
#
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer
# The shortest piece of information that tells how a system behaves: the version
Get-IshVersion
# Returns the TimeZone of the WebApp server; includes timings of
# . Client to WebApp server
# . WebApp server to Database server
Get-IshTimeZone
# Boolean version of New-IshSession, allowing localhost test
Test-IshSession -WsBaseUrl https://localhost/ISHWSSDLDOC/ -PSCredential ddemeyer -IgnoreSslPolicyErrors




#
# Working with files - Only for inspiration, not easy to demo
#
# Use the .NET Xml Handling to validate your incoming OASIS XML files
Get-ChildItem -Path C:\temp\*.xml | Test-IshValidXml -XmlCatalogFilePath C:\InfoShare\Web\Author\ASP\DocTypes\catalog.xml

# Given specialized OASIS DITA files, and a before and after catalog/DocTypes
# This cmdlet generalizes, even e.g. Reference to Topic
Get-ChildItem $inputfolder -Include *.xml -Recurse |
New-IshDitaGeneralizedXml -SpecializedCatalogFilePath $SpecializedCatalogFilePath `
-GeneralizedCatalogFilePath $GeneralizedCatalogFilePath `
-GeneralizationCatalogMappingFilePath $GeneralizationCatalogMappingFilePath `
-AttributesToGeneralizeToProps $attributesToGeneralizeToProps `
-AttributesToGeneralizeToBase $attributesToGeneralizeToBase `
-FolderPath $outputfolder

# Given OASIS DITA files and images, the framework DITA is maintained for test cases
# The content however get fixes replacement, every 8-letter word becomes 'zucchini'
Get-ChildItem $inputfolder -File |
New-IshObfuscatedFile -OutputFolder $outputfolder -XmlAttributesToObfuscate @("navtitle")




#
# Create Users from scratch or reading from Active Directory or LDAP
#
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer
$metadata = `
Set-IshMetadataField -Name "FISHUSERDISPLAYNAME" -Value ("Frank Demo " + (Get-Date)) |
Set-IshMetadataField -Name "FISHEMAIL" -Value "Frank.Demo@sdl.com" |
Set-IshMetadataField -Name "FISHUSERLANGUAGE" -Value "en-us" |
Set-IshMetadataField -Name "PASSWORD" -Value "demo" |
Set-IshMetadataField -Name "FUSERGROUP" -Value "Default Department" |
Set-IshMetadataField -Name "FISHUSERROLES" -Value "Reviewer, Author" |
Set-IshMetadataField -Name "FISHUSERTYPE" -ValueType Element -Value "VUSERTYPEINTERNAL"
Add-IshUser -Name "fdemo" -Metadata $metadata
# Verifying the user
Test-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -IshUserName fdemo -IshPassword demo
# Find-IshUser -MetadataFilter (Set-IshMetadataFilterField -Name NAME -FilterOperator Equal -Value fdemo) | Remove-IshUser # To clean up unlinked demo users




#
# Reporting on Users
#
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer

# Retrieve a selection of user objects with the default requested metadata using the standard Out-GridView cmdlet
$metadataFilter = Set-IshMetadataFilterField -Name FISHUSERDISPLAYNAME -FilterOperator Like -Value Frank
$selectedUsers = Find-IshUser -MetadataFilter $metadataFilter |
Out-GridView -OutputMode Multiple -Title "Select one or more entries...“

# Pass the selected user objects to the standard Export-Csv cmdlet
$selectedUsers | Export-Csv -Append -Force -Path "C:\TEMP\selectedUsers.csv"

# Pass the selected user objects straight to Microsoft Excel
# Requires: Install-Module ImportExcel -scope CurrentUser
$selectedUsers | Export-Excel




#
# Reporting on Folders
#
New-IshSession -WsBaseUrl https://medevddemeyer10.global.sdl.corp/ISHWSSDLDOC/ -PSCredential ddemeyer
# Progress bars are implemented for longer running operations
Get-IshFolder -BaseFolder System -Recurse | Get-IshFolderLocation


#
# DONE
#

Have fun,
Dave

Anonymous