Public/Reset-DMLocalUserPassword.ps1
|
function Reset-DMLocalUserPassword { [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] param( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [pscustomobject]$WebSession, [Parameter(Mandatory = $true)][string]$Id, [Parameter(Mandatory = $true)][object]$Password, [hashtable]$Property = @{} ) $session = if ($WebSession) { $WebSession } else { $script:CurrentOceanstorSession } $body = @{} + $Property $body.PASSWORD = ConvertFrom-DMSensitiveValue -Value $Password $encodedId = [uri]::EscapeDataString($Id) if ($PSCmdlet.ShouldProcess($Id, 'Reset local user password')) { $response = Invoke-DeviceManager -WebSession $session -Method 'PUT' -Resource "initialize_user_pwd/$encodedId" -BodyData $body $response = $response | Assert-DMApiSuccess return $response.error } } |