Skip to content

Commit 05f8d89

Browse files
authored
Merge pull request #1146 from JohnDuprey/dev
Fix LAPS & error msgs
2 parents 441a910 + f5d532f commit 05f8d89

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Modules/CIPPCore/Public/Get-CIPPBitlockerKey.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Get-CIPPBitlockerKey {
1515
return $GraphRequest
1616
} catch {
1717
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
18-
Write-LogMessage -user $ExecutingUser -API $APIName -message "Could not add OOO for $($userid)" -Sev 'Error' -tenant $TenantFilter -LogData (Get-CippException -Exception $_)
19-
return "Could not add out of office message for $($userid). Error: $ErrorMessage"
18+
Write-LogMessage -user $ExecutingUser -API $APIName -message "Could not retrieve bitlocker recovery key for $($device)" -Sev 'Error' -tenant $TenantFilter -LogData (Get-CippException -Exception $_)
19+
return "Could not retrieve bitlocker recovery key for $($device). Error: $ErrorMessage"
2020
}
2121
}

Modules/CIPPCore/Public/Get-CIPPLAPSPassword.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ function Get-CIPPLapsPassword {
99
)
1010

1111
try {
12-
$GraphRequest = (New-GraphGetRequest -noauthcheck $true -uri "https://graph.microsoft.com/beta/deviceLocalCredentials/$($device)?`$select=credentials" -tenantid $TenantFilter).credentials | Select-Object -First 1 | ForEach-Object {
12+
$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
1515
"The password for $($_.AccountName) is $($PlainText) generated at $($date)"
1616
}
1717
if ($GraphRequest) { return $GraphRequest } else { return "No LAPS password found for $device" }
1818
} catch {
1919
$ErrorMessage = Get-CippException -Exception $_
20-
Write-LogMessage -user $ExecutingUser -API $APIName -message "Could not add OOO for $($userid). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -tenant $TenantFilter -LogData $ErrorMessage
21-
return "Could not add out of office message for $($userid). Error: $($ErrorMessage.NormalizedError)"
20+
Write-LogMessage -user $ExecutingUser -API $APIName -message "Could not retrieve LAPS password for $($device). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -tenant $TenantFilter -LogData $ErrorMessage
21+
return "Could not retrieve LAPS password for $($device). Error: $($ErrorMessage.NormalizedError)"
2222
}
2323
}
2424

0 commit comments

Comments
 (0)