|
| 1 | +--- |
| 2 | +description: Queries Azure Active Directory (AAD) for the Windows Local Administrator Password Solution (LAPS) credentials on a specified Azure AD device. |
| 3 | +external help file: LAPS-help.xml |
| 4 | +Module Name: LAPS |
| 5 | +online version: https://learn.microsoft.com/powershell/module/laps/get-lapsaadpassword?view=windowsserver2019-ps&wt.mc_id=ps-gethelp |
| 6 | +schema: 2.0.0 |
| 7 | +Locale: en-US |
| 8 | +ms.date: 04/10/2023 |
| 9 | +title: Get-LapsAADPassword |
| 10 | +--- |
| 11 | + |
| 12 | +# Get-LapsAADPassword |
| 13 | + |
| 14 | +## SYNOPSIS |
| 15 | +Queries Azure Active Directory (AAD) for the Windows Local Administrator Password Solution (LAPS) |
| 16 | +credentials on a specified Azure AD device. |
| 17 | + |
| 18 | +## SYNTAX |
| 19 | + |
| 20 | +``` |
| 21 | +Get-LapsAADPassword -DeviceIds <String[]> [-IncludePasswords] [-IncludeHistory] [-AsPlainText] |
| 22 | + [<CommonParameters>] |
| 23 | +``` |
| 24 | + |
| 25 | +## DESCRIPTION |
| 26 | + |
| 27 | +The `Get-LapsAADPassword` cmdlet allows administrators to retrieve LAPS passwords and password |
| 28 | +history for an AAD-joined device. This is implemented by sending queries to Microsoft Graph over the |
| 29 | +deviceLocalCredentials collection. |
| 30 | + |
| 31 | +The `Get-LapsAADPassword` cmdlet supports two basic modes when querying LAPS passwords: |
| 32 | + |
| 33 | +The first mode queries for non-sensitive metadata, for example time the password was backed up to |
| 34 | +Azure and the expected expiration time of a password. This mode requires that the client be granted |
| 35 | +the Microsoft Graph `DeviceLocalCredential.ReadBasic.All` permission. |
| 36 | + |
| 37 | +The second mode queries for all password information including both the metadata information |
| 38 | +described above and the clear-text form of the password(s). This mode requires that the client be |
| 39 | +granted the Microsoft Graph `DeviceLocalCredential.Read.All` permission. |
| 40 | + |
| 41 | +The **DeviceIds** parameter accepts either device names or device IDs, but the underlying Microsoft |
| 42 | +Graph queries only supports querying by device ID. To support this query, the cmdlet maps a device |
| 43 | +name input to its corresponding device ID by issuing a separate Microsoft Graph query. This extra |
| 44 | +query requires the `Device.Read.All` permission. If the target is a Microsoft Managed Desktop |
| 45 | +device, the `DeviceManagementManagedDevices.Read.All` permission may also be required. |
| 46 | + |
| 47 | +> [!TIP] |
| 48 | +> If there are multiple devices in the tenant with the same name, the cmdlet fails. The workaround |
| 49 | +> is to input the device ID directly. |
| 50 | +
|
| 51 | +> [!IMPORTANT] |
| 52 | +> The `Get-LapsAADPassword` cmdlet is implemented as a wrapper around the Microsoft Graph PowerShell |
| 53 | +> library, which must be manually installed on the device before `Get-LapsAADPassword` can work. |
| 54 | +> Additional configuration steps are required in your AAD tenant to enable authentication to |
| 55 | +> Microsoft Graph and to grant the necessary Microsoft Graph permissions. For more information, see |
| 56 | +> [Get started with Windows LAPS and Azure Active Directory](https://go.microsoft.com/fwlink/?linkid=2233704) |
| 57 | +
|
| 58 | +The **Verbose** parameter may be used to get additional information about the cmdlet's operation. |
| 59 | + |
| 60 | +## EXAMPLES |
| 61 | + |
| 62 | +### Example 1 |
| 63 | + |
| 64 | +```powershell |
| 65 | +Connect-MgGraph -TenantId b20f5886-bddf-43bb-aee6-dda0c87c5fa2 -ClientId 9fa98e34-277f-47fa-9847-e36bdf6bca1f |
| 66 | +Get-LapsAADPassword -DeviceIds LAPSAAD |
| 67 | +``` |
| 68 | + |
| 69 | +```Output |
| 70 | +DeviceName DeviceId PasswordExpirationTime |
| 71 | +---------- -------- ---------------------- |
| 72 | +LAPSAAD dfc6d5f0-225a-4b46-adcf-73a349a31e70 4/22/2023 8:45:29 AM |
| 73 | +``` |
| 74 | + |
| 75 | +This example shows how to query basic LAPS password metadata information for the target device that |
| 76 | +is specified by device name. |
| 77 | + |
| 78 | +### Example 2 |
| 79 | + |
| 80 | +```powershell |
| 81 | +Connect-MgGraph -TenantId b20f5886-bddf-43bb-aee6-dda0c87c5fa2 -ClientId 9fa98e34-277f-47fa-9847-e36bdf6bca1f |
| 82 | +Get-LapsAADPassword -DeviceIds dfc6d5f0-225a-4b46-adcf-73a349a31e70 -IncludePasswords |
| 83 | +``` |
| 84 | + |
| 85 | +```Output |
| 86 | +DeviceName : LAPSAAD |
| 87 | +DeviceId : dfc6d5f0-225a-4b46-adcf-73a349a31e70 |
| 88 | +Account : LapsAdmin |
| 89 | +Password : System.Security.SecureString |
| 90 | +PasswordExpirationTime : 4/22/2023 8:45:29 AM |
| 91 | +PasswordUpdateTime : 4/11/2023 8:45:29 AM |
| 92 | +``` |
| 93 | + |
| 94 | +This example shows how to query the full LAPS password information for the target device that is |
| 95 | +specified by device ID. |
| 96 | + |
| 97 | +### Example 3 |
| 98 | + |
| 99 | +```powershell |
| 100 | +Connect-MgGraph -TenantId b20f5886-bddf-43bb-aee6-dda0c87c5fa2 -ClientId 9fa98e34-277f-47fa-9847-e36bdf6bca1f |
| 101 | +Get-LapsAADPassword -DeviceIds dfc6d5f0-225a-4b46-adcf-73a349a31e70 -IncludePasswords -AsPlainText |
| 102 | +``` |
| 103 | + |
| 104 | +```Output |
| 105 | +DeviceName : LAPSAAD |
| 106 | +DeviceId : dfc6d5f0-225a-4b46-adcf-73a349a31e70 |
| 107 | +Account : LapsAdmin |
| 108 | +Password : g4q22s[Xz8}!T32[4;Z#0M}v35udF[xB0}iB;P@xk%9E9Tgw,W]7)vx9O!- |
| 109 | +PasswordExpirationTime : 4/22/2023 8:45:29 AM |
| 110 | +PasswordUpdateTime : 4/11/2023 8:45:29 AM |
| 111 | +``` |
| 112 | + |
| 113 | +This example shows how to query the full LAPS password information for the target device that is |
| 114 | +specified by device ID, and displaying the password in clear-text form. |
| 115 | + |
| 116 | +### Example 4 |
| 117 | + |
| 118 | +```powershell |
| 119 | +Connect-MgGraph -TenantId b20f5886-bddf-43bb-aee6-dda0c87c5fa2 -ClientId 9fa98e34-277f-47fa-9847-e36bdf6bca1f |
| 120 | +Get-LapsAADPassword -DeviceIds lapsAAD -IncludePasswords -AsPlainText -IncludeHistory |
| 121 | +``` |
| 122 | + |
| 123 | +```Output |
| 124 | +DeviceName : LAPSAAD |
| 125 | +DeviceId : dfc6d5f0-225a-4b46-adcf-73a349a31e70 |
| 126 | +Account : LapsAdmin |
| 127 | +Password : ]5j)1fi]Rv&Pj+IMiAzq1R9b+yJ.@Q,80#01U541vsC8$Vv${hac8TJlkT8 |
| 128 | +PasswordExpirationTime : 4/22/2023 8:55:20 AM |
| 129 | +PasswordUpdateTime : 4/11/2023 8:55:21 AM |
| 130 | +
|
| 131 | +DeviceName : LAPSAAD |
| 132 | +DeviceId : dfc6d5f0-225a-4b46-adcf-73a349a31e70 |
| 133 | +Account : LapsAdmin |
| 134 | +Password : t&.1P%9891]24I0X4AA4O22a30R1lz(ar7N9{tTf349.Iz{L82O6v{I+,gg |
| 135 | +PasswordExpirationTime : |
| 136 | +PasswordUpdateTime : 4/11/2023 8:55:16 AM |
| 137 | +
|
| 138 | +DeviceName : LAPSAAD |
| 139 | +DeviceId : dfc6d5f0-225a-4b46-adcf-73a349a31e70 |
| 140 | +Account : LapsAdmin |
| 141 | +Password : g4q22s[Xz8}!T32[4;Z#0M}v35udF[xB0}iB;P@xk%9E9Tgw,W]7)vx9O!- |
| 142 | +PasswordExpirationTime : |
| 143 | +PasswordUpdateTime : 4/11/2023 8:45:29 AM |
| 144 | +``` |
| 145 | + |
| 146 | +This example shows how to query the full LAPS password information for the target device that is |
| 147 | +specified by device name, requesting password history, and displaying the passwords in clear-text |
| 148 | +form. |
| 149 | + |
| 150 | +## PARAMETERS |
| 151 | + |
| 152 | +### -AsPlainText |
| 153 | + |
| 154 | +Specify this parameter to return the LAPS passwords in clear-text format. The default behavior is to |
| 155 | +return the LAPS passwords wrapped in a .NET **SecureString** object. |
| 156 | + |
| 157 | +> [!IMPORTANT] |
| 158 | +> Using this parameter exposes the returned clear-text password to casual viewing and may pose a |
| 159 | +> security risk. This parameter should be used with caution and only in support or testing |
| 160 | +> situations. |
| 161 | +
|
| 162 | +```yaml |
| 163 | +Type: System.Management.Automation.SwitchParameter |
| 164 | +Parameter Sets: (All) |
| 165 | +Aliases: |
| 166 | + |
| 167 | +Required: False |
| 168 | +Position: Named |
| 169 | +Default value: None |
| 170 | +Accept pipeline input: False |
| 171 | +Accept wildcard characters: False |
| 172 | +``` |
| 173 | +
|
| 174 | +### -DeviceIds |
| 175 | +
|
| 176 | +Specifies the device name or device ID to query LAPS credentials. |
| 177 | +
|
| 178 | +```yaml |
| 179 | +Type: System.String[] |
| 180 | +Parameter Sets: (All) |
| 181 | +Aliases: |
| 182 | + |
| 183 | +Required: True |
| 184 | +Position: Named |
| 185 | +Default value: None |
| 186 | +Accept pipeline input: False |
| 187 | +Accept wildcard characters: False |
| 188 | +``` |
| 189 | +
|
| 190 | +### -IncludeHistory |
| 191 | +
|
| 192 | +Specifies that any older LAPS credentials on the device object should also be displayed. |
| 193 | +
|
| 194 | +```yaml |
| 195 | +Type: System.Management.Automation.SwitchParameter |
| 196 | +Parameter Sets: (All) |
| 197 | +Aliases: |
| 198 | + |
| 199 | +Required: False |
| 200 | +Position: Named |
| 201 | +Default value: None |
| 202 | +Accept pipeline input: False |
| 203 | +Accept wildcard characters: False |
| 204 | +``` |
| 205 | +
|
| 206 | +### -IncludePasswords |
| 207 | +
|
| 208 | +Specifies whether to return password information. |
| 209 | +
|
| 210 | +```yaml |
| 211 | +Type: System.Management.Automation.SwitchParameter |
| 212 | +Parameter Sets: (All) |
| 213 | +Aliases: |
| 214 | + |
| 215 | +Required: False |
| 216 | +Position: Named |
| 217 | +Default value: None |
| 218 | +Accept pipeline input: False |
| 219 | +Accept wildcard characters: False |
| 220 | +``` |
| 221 | +
|
| 222 | +### CommonParameters |
| 223 | +
|
| 224 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, |
| 225 | +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, |
| 226 | +-WarningAction, and -WarningVariable. For more information, see |
| 227 | +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 228 | +
|
| 229 | +## INPUTS |
| 230 | +
|
| 231 | +### None |
| 232 | +
|
| 233 | +## OUTPUTS |
| 234 | +
|
| 235 | +### System.Object |
| 236 | +
|
| 237 | +## NOTES |
| 238 | +
|
| 239 | +## RELATED LINKS |
| 240 | +
|
| 241 | +[Windows LAPS Overview](https://go.microsoft.com/fwlink/?linkid=2233901) |
| 242 | +
|
| 243 | +[Get started with Windows LAPS and Azure Active Directory](https://go.microsoft.com/fwlink/?linkid=2233704) |
0 commit comments