powershellwrapper icon indicating copy to clipboard operation
powershellwrapper copied to clipboard

Enhancement - filter configurations and passwords for archived entries

Open RaavStormfang opened this issue 3 years ago • 2 comments

recently the api updated to allow filtering configurations and passwords for archived entries. either for or against.

I've tested this out with great success on my side and used it to archive over 3000 stale RMM entries from automate, pulling only configurations that have the status of 'AUTOMATE_INACTIVE' and not archived already. its been great, and has allowed me to avoid several loops in a script, keeping it far cleaner than it otherwise would have been with pagination.

thess changes have been inserted into Configurations.ps1 under the get-itglueconfigurations function

    [Parameter(ParameterSetName = 'index')]
    [Parameter(ParameterSetName = 'index_rmm')]
    [Parameter(ParameterSetName = 'index_psa')]
    [Parameter(ParameterSetName = 'index_rmm_psa')]
    [Nullable[bool]]$filter_archived = $null,

and

    if ($filter_archived) {
        $body += @{'filter[archived]' = $filter_archived}
    }

Here are the changes for Passwords.ps1 under the get-itgluepasswords function

    [Parameter(ParameterSetName = 'index')]
    [Nullable[bool]]$filter_archived = $null,

and

    if ($filter_archived) {$body += @{'filter[archived]' = $filter_archived}
    }

I didn't see a great spot for them, so i just threw them under $filter_name everywhere.

everything seems to work alright. was wondering if I could create a branch for you to take a look at, or if you could implement this feature yourself

RaavStormfang avatar Jun 18 '21 16:06 RaavStormfang

@jswartz8472 thank you for sharing. Yes, if you are willing to submit it that will be helpful.

adrianwells avatar Jun 18 '21 18:06 adrianwells

pull request 126 created. made a fork

RaavStormfang avatar Jun 18 '21 20:06 RaavStormfang

This issue is resolved by PR #126 and should be closed.

davidhaymond avatar Dec 05 '22 17:12 davidhaymond

Closing per @davidhaymond's comment. Thanks.

adrianwells avatar Dec 05 '22 18:12 adrianwells