Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Okta.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,43 @@ function oktaResetPasswordbyID()
return $request
}

function oktaSetPasswordbyID()
{
param
(
[parameter(Mandatory=$false)][ValidateLength(1,100)][String]$oOrg=$oktaDefOrg,
[parameter(Mandatory=$true)][ValidateLength(20,20)][String]$uid,
[parameter(Mandatory=$true)][Security.SecureString]$password
)
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password)
$PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$psobj = @{
"credentials" = @{
"password" = @{ "value" = $PlainPassword }
}
}

[string]$method = "Put"
[string]$resource = "/api/v1/users/" + $uid
try
{
$request = _oktaNewCall -oOrg $oOrg -method $method -resource $resource -body $psobj
}
catch
{
if ($oktaVerbose -eq $true)
{
Write-Host -ForegroundColor red -BackgroundColor white $_.TargetObject
}
throw $_
}
foreach ($user in $request)
{
$user = OktaUserfromJson -user $user
}
return $request
}

function oktaConvertUsertoFederation()
{
param
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ catch
- oktaResetFactorsbyUser
- oktaResetPasswordbyID
- oktaSetAppidCredentialUsername
- oktaSetPasswordbyID
- oktaUnlockUserbyId
- oktaUpdateApp
- oktaUpdateAppExternalIdbyUserId
Expand Down