Created
October 24, 2023 22:50
-
-
Save nathanmcnulty/f991ad95d356bd43e4b2c5fcc57c2ae2 to your computer and use it in GitHub Desktop.
Use LAPS to get user profile folder list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ADComputer -Filter * | ForEach-Object { | |
$laps = (Get-LapsADPassword $_) | |
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $laps.Account, $laps.Password | |
Invoke-Command -ComputerName $_ -Credential $cred -ScriptBlock { $env:COMPUTERNAME; (Get-ChildItem).Name } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment