Get-AllLapsPwd.ps1


<#PSScriptInfo
 
.VERSION 1.1
 
.GUID 63ea57e6-7f65-4423-935b-1c7e8bfde5cc
 
.AUTHOR Kalichuza
 
.COMPANYNAME
 
.COPYRIGHT
 
.TAGS
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
.PRIVATEDATA
 
#>


<#
 
.DESCRIPTION
 list all Laps passwords
 
#>
 
Import-Module AdmPwd.PS
immport-module activedirectory

Param(
    [string]$OU
)

$computers = Get-ADComputer -Filter * | Where-Object { $_.DistinguishedName -like "*$OU*" }

foreach ($computer in $computers) {
    $computerName = $computer.Name
    $LapsPwd = Get-AdmPwdPassword -ComputerName $computerName
    $LapsPwd
}