Adding a New Password Reset Dependency ​
POST /winapi/dependencies
When an account is enabled to perform Password Resets, it possible to have dependent tasks which can also be executed at the same time the password is reset. Examples of this are where Active Directory accounts are being used for Windows Services, Scheduled Tasks and IIS Application Pools.
You can also add a dependent reset task which does not relate to these types of Windows resources i.e. you can execute any custom PowerShell script you want.
This method returns the new Dependency object as described below.
Note: HostName is an optional field, and only needs to be specified if the dependent task needs to be executed on a specific Host.
Powershell
# PowerShell Request
#JSON data for the object
$Body = @{
PasswordID = $PasswordID
HostName = "win2k12server78.domain.local"
DependencyType = "Windows Service"
DependencyName = "Custom Windows Service"
ScriptID = "17"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateUrl = 'https://passwordstate/winapi/dependencies'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateUrl -ContentType "application/json" -Body $jsonData -UseDefaultCredentialsJson
# Response
HTTP/1.1 200
[
{
"TaskID": 57,
"DependencyType": "Windows Service",
"DependencyName": "Custom Windows Service",
"HostName": "win2k12server78.domain.local",
"PasswordID": "1874",
"ScriptID": "17"
}
]Below is a description of each of the parameters for this API Method:
| Heading | Data Type | Description |
|---|---|---|
| DependencyType | String | DependencyType relates to Windows type resources. Possible values are Windows Service, IIS Application Pool, Scheduled Tasks and COM+ Component. |
| DependencyName | String | The actual name of the Dependency, as it relates to Windows resources i.e. the name of a Windows Service, or Scheduled Task. |
| HostName | String | If this dependent task is to be executed against a specific Host, then you specify the name of the Host here - it must match the name of the Host as it is recorded in Passwordstate. If this dependent task is not to be executed against a specific Host, then this field can be omitted. |
| PasswordID | Integer | The PasswordID value of the password record in Passwordstate. |
| ScriptID | Integer | The ScriptID value of the dependent script which will be executed, once the Password record has finished executing its own password reset task. |