Skip to content

Commit dd09ebe

Browse files
committed
feat: Retrieve LAPS output
1 parent 3ed6a4a commit dd09ebe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/CIPPCore/Public/Get-CIPPLAPSPassword.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ function Get-CIPPLapsPassword {
1212
$GraphRequest = (New-GraphGetRequest -noauthcheck $true -uri "https://graph.microsoft.com/beta/directory/deviceLocalCredentials/$($device)?`$select=credentials" -tenantid $TenantFilter).credentials | Select-Object -First 1 | ForEach-Object {
1313
$PlainText = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_.passwordBase64))
1414
$date = $_.BackupDateTime
15-
"The password for $($_.AccountName) is $($PlainText) generated at $($date)"
15+
[PSCustomObject]@{
16+
resultText = "LAPS password retrieved, generated at $($date). Copy the password by clicking the copy button"
17+
copyField = $PlainText
18+
state = 'success'
19+
}
1620
}
1721
if ($GraphRequest) { return $GraphRequest } else { return "No LAPS password found for $device" }
1822
} catch {

0 commit comments

Comments
 (0)