Jump to content

Delete a passwordlist with powershell


Lesley Spiessens

Recommended Posts

We want to delete several passwordlists ( a 1000 with all the same listname) in our passwordstate automatically with the API (powershell)

How do we manage that ?

 

Did try something like this:

 

$PasswordstateUrl = 'https://My-URL/api/passwordlists'

$Result = Invoke-Restmethod -Method GET -Uri $PasswordstateUrl -Header @{ "APIKey" = "key x" }

$Result

$Max = ($Result.PasswordListID).count

for ($i=0; $i -le $Max; $i++)

{

$a = $result.PasswordList[$i]

if ($a -eq "Windows Users")

{

$PasswordListID_value = $result.PasswordListID[$i]

$PasswordstateDELUrl = 'https://MY-URL/api/passwordlists/' + $PasswordListID_value + '?MoveToRecycleBin=True'

Write-Host $PasswordstateDELUrl

Invoke-Restmethod -Method delete -Uri $PasswordstateDELUrl -Header @{ "APIKey" = "key x" }

 

}

}

 This gives only an invalid API call

Link to comment
Share on other sites

Hi Lesley,

 

I've responded to your support email regarding this, and we do not have a API command for deleting Password Lists, which is why your code above is failing.

 

We've emailed you a SQL Script which can be used for this.

Regards

Click Studios

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...