Jump to content

Password Generator Policies


sbt

Recommended Posts

Hi there,

 

I have created passwordlists via API providing a password list template. The new lists work fine, but I realized that the Password Generator Policy is not being taken from the template. Instead the "Default Password Generator" policy is being used.

Is this a general problem?

 

Cheers

Sebastian

Link to comment
Share on other sites

Never mind, the script worked in the customer's environment, so you can close the topic.

Here's my powershell function.

 

Function Add-PasswordList {
    param(
        [parameter(Mandatory=$true)]
        [string]$PasswordstateURL,
        [parameter(Mandatory=$true)]
        [string]$Passwordlistname,
        [parameter(Mandatory=$true)]
        [int]$PasswordlistTemplateID,
        [parameter(Mandatory=$true)]
        [int]$PasswordlistAdminGroupID,
        [parameter(Mandatory=$true)]
        [int]$PasswordGeneratorID
    )

    if ($PasswordstateURL.EndsWith('/')) {
        $PasswordstateURL.Remove($PasswordstateURL.Length-1,1)
    }

    if ($Passwordlist = Get-PasswordList -PasswordstateURL $PasswordstateURL -Passwordlistname $Passwordlistname) {
        Write-Error "Passwordlist with the name '$($Passwordlistname)' already exists"
        return $false
    }

    $jsonData = @"
        {
        "PasswordList":"$($Passwordlistname)",
        "Description":"$($Passwordlistname)'s Passwords",
        "ApplyPermissionsForSecurityGroupID":"$($PasswordlistAdminGroupID)",
        "Permission":"A",
        "CopySettingsFromTemplateID":"$PasswordlistTemplateID",
        "LinkToTemplate":true,
        "PasswordGeneratorID":"$PasswordGeneratorID",
        "NestUnderFolderID":"0"
        }
"@

    $PasswordstateUrl = "$($PasswordstateURL)/winapi/passwordlists"
    $PasswordList = Invoke-Restmethod -Method Post -Uri $PasswordstateUrl -ContentType "application/json" -Body $jsonData -UseDefaultCredentials -UseBasicParsing
    return $PasswordList
}

 

$List = Add-PasswordList -PasswordstateURL $PasswordstateURL -Passwordlistname $PasswordStateUser.SamAccountName -PasswordlistTemplateID 13 -PasswordlistAdminGroupID 2 -PasswordGeneratorID 2

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...