ISHRemote - How to gather object names and GUIDs of objects in a folder

I'd like to obtain object names and GUIDs of objects that are stored in the specified folder. I wrote the following script, and it successfully listed all object names in the specified folder.

Get-IshFolder -FolderPath $td_folder_path | Get-IshFolderContent | Get-IshDocumentObj | Get-IshMetadataField -Name FTITLE -Level Logical

However, I couldn't find a way to obtain GUIDs of the objects in the folder.

Any advice apperiated.

Naoki

emoji
Parents
  • You've solved it Naoki!

    For others that want to experiment, the below you can execute on any system and gives you a lot of data about your editor templates

    Get-IshFolder -FolderPath "\System Management\Editor Templates" -Recurse | Get-IshFolderContent | Export-Csv -Path C:\temp\deletethis.csv

    Did you know there is a PowerShell module that exports straight to Excel

    # Requires: Install-Module ImportExcel -scope CurrentUser
    Get-IshFolder -FolderPath "\System Management\Editor Templates" -Recurse | Get-IshFolderContent | Export-Excel

    emoji
  • Hi Dave,

    I realized that the Get-IshFolderContent output can be exported to Excel file so easy. Thank you for letting me know the smart way!

    Following is my result of fight with PowerShell, though it isn't sophisticated...

    # Syntax: > .\get-object-properties.ps1 <td_folder_path>
    # Output: $env:USERPROFILE\Desktop\topics_yyyyMMddHHmmss.csv

    New-IshSession -WsBaseUrl https://*****/ISHWS/ -IshUserName ***** -IshPassword *****

    $objectsArrayList = New-Object System.Collections.ArrayList
    $objectsInTheFolder = Get-IshFolder -FolderPath $td_folder_path | Get-IshFolderContent | Get-IshDocumentObj
    foreach($object in $objectsInTheFolder) {
      $objectName = Get-IshMetadataField -IshObject $object -Name FTITLE -Level Logical
      $quoted_FTITLE = '"' + [string]$objectName + '"'
      $quoted_GUID = '"' + [string]$object.IshRef + '"'
      $one_record = $quoted_FTITLE + "," + $quoted_GUID
      $objectsArrayList.Add($one_record)
    }
    $objectsArrayList = $objectsArrayList | Sort-Object

    $timestamp = Get-Date -Format "yyyyMMddHHmmss"
    $csv_fname = "topics_$timestamp.csv"
    $csv_fpath = "$env:USERPROFILE\Desktop\$csv_fname"
    Add-Content -Path $csv_fpath -Value 'FTITLE, GUID' -Encoding utf8BOM
    $objectsArrayList | foreach { Add-Content -Path $csv_fpath -Value $_ }

    emoji
Reply
  • Hi Dave,

    I realized that the Get-IshFolderContent output can be exported to Excel file so easy. Thank you for letting me know the smart way!

    Following is my result of fight with PowerShell, though it isn't sophisticated...

    # Syntax: > .\get-object-properties.ps1 <td_folder_path>
    # Output: $env:USERPROFILE\Desktop\topics_yyyyMMddHHmmss.csv

    New-IshSession -WsBaseUrl https://*****/ISHWS/ -IshUserName ***** -IshPassword *****

    $objectsArrayList = New-Object System.Collections.ArrayList
    $objectsInTheFolder = Get-IshFolder -FolderPath $td_folder_path | Get-IshFolderContent | Get-IshDocumentObj
    foreach($object in $objectsInTheFolder) {
      $objectName = Get-IshMetadataField -IshObject $object -Name FTITLE -Level Logical
      $quoted_FTITLE = '"' + [string]$objectName + '"'
      $quoted_GUID = '"' + [string]$object.IshRef + '"'
      $one_record = $quoted_FTITLE + "," + $quoted_GUID
      $objectsArrayList.Add($one_record)
    }
    $objectsArrayList = $objectsArrayList | Sort-Object

    $timestamp = Get-Date -Format "yyyyMMddHHmmss"
    $csv_fname = "topics_$timestamp.csv"
    $csv_fpath = "$env:USERPROFILE\Desktop\$csv_fname"
    Add-Content -Path $csv_fpath -Value 'FTITLE, GUID' -Encoding utf8BOM
    $objectsArrayList | foreach { Add-Content -Path $csv_fpath -Value $_ }

    emoji
Children
No Data