Unable to download objects using IshRemote

Hi,

I'm unable to get this script to work, would someone be able to take a peek at it?   maybe? :D 

This gist is, I'm trying to download the latest version of all map objects from my repo modified after 2019. I need to do some analysis on our doc set. Let me know if any more info is needed.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ishSession = New-IshSession -WsBaseUrl "https://*******/ISHWS" -IshUserName "******" -IshPassword "******"
# Define MetadataFields for status and FDOCUMENTS
$statusFields = Set-IshMetadataFilterField -IshSession $ishSession -Name "FSTATUS" -Level "Lng" -ValueType "Element" -FilterOperator "Equal" -Value "VSTATUSRELEASED"
$cardtypeFields = Set-IshMetadataFilterField -IshSession $ishSession -Name "FMASTERTYPE" -Level "Logical" -ValueType "Value" -FilterOperator "Equal" -Value "Map"
$modifiedOn = Set-IshMetadataFilterField -Level Lng -Name MODIFIED-ON -FilterOperator GreaterThanOrEqual -Value "01/01/2019"
$docLang = Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator Equal -Value en
# Merge metadatafields into an array
$metadataFields = $statusFields, $cardtypeFields, $modifiedOn, $docLang
# Get unique logical objects
$logicalIds = Find-IshDocumentObj -IshSession $ishSession -MetadataFilter $metadataFields | Select-Object -Property IshRef -Unique
# Define the directory where files will be downloaded
$directoryPath = "D:\InfoShare\Data\Publish\ExportedMaps"
# Create the directory if it does not exist
if (!(Test-Path -Path $directoryPath)) {
New-Item -ItemType Directory -Path $directoryPath
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

thanks,

Charlie

emoji