Using ISHRemote how can I exclude folders based on their names?

Hi,

I am trying to get a count of topics within a root folder but excluding subfolders with certain words in their names.

I have tried the following but it is still returning folders named 'retired' and 'Archived'

What am I doing wrong?

Any advice appreciated,

Regards,

Ann

emoji
Parents
  • Automation can be beautiful and really speed up some manual process like counting. However, a script can do things 1000s of times faster than a user clicking around, hence we should all be on the lookout that a script can really bring a system to its knees!

    Regarding your first part, I rewrote using -BaseFolder EditorTemplate as a sample, because every system has that and can experiment with this code.. Compared to your sample

    1. Line 2 filter on IShFolderType is the same as the Line 1 -FolderTypeFilter, so superfluous.
    2. The loop operator in PowerShell, so inside your Where-Object cmdlet is $_ ... you want to address properties of that loop object, so you need "." (dot)
    3. In turn, Colin earlier is right that you are not using the operator -notlike correctly, it is missing the wildcards "*" (asterix)

    Regarding part 2, you are counting logical objects (IshRef) property, then the Get-IshDocumentObj in the foreach statement is superfluous and causes a lot of API/Database traffic. 

    If Get-IshDocumentObj is an attempt to get all versions and languages, it is missing parameters. Currently it only retrieves all languages from the Latest version.

    Best wishes,
    Dave

    emoji
Reply
  • Automation can be beautiful and really speed up some manual process like counting. However, a script can do things 1000s of times faster than a user clicking around, hence we should all be on the lookout that a script can really bring a system to its knees!

    Regarding your first part, I rewrote using -BaseFolder EditorTemplate as a sample, because every system has that and can experiment with this code.. Compared to your sample

    1. Line 2 filter on IShFolderType is the same as the Line 1 -FolderTypeFilter, so superfluous.
    2. The loop operator in PowerShell, so inside your Where-Object cmdlet is $_ ... you want to address properties of that loop object, so you need "." (dot)
    3. In turn, Colin earlier is right that you are not using the operator -notlike correctly, it is missing the wildcards "*" (asterix)

    Regarding part 2, you are counting logical objects (IshRef) property, then the Get-IshDocumentObj in the foreach statement is superfluous and causes a lot of API/Database traffic. 

    If Get-IshDocumentObj is an attempt to get all versions and languages, it is missing parameters. Currently it only retrieves all languages from the Latest version.

    Best wishes,
    Dave

    emoji
Children