Initial commit
This commit is contained in:
commit
6b41a7b390
62
LAPS/LAPS.psm1
Normal file
62
LAPS/LAPS.psm1
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
|
||||||
|
Read laps passwort and exiration date from active directory
|
||||||
|
|
||||||
|
.DESCRIOTION
|
||||||
|
|
||||||
|
Read laps passwort and exiration date from active directory. You can pipe hostnames as input or define as parameter.
|
||||||
|
|
||||||
|
.INPUTS
|
||||||
|
|
||||||
|
Pipe names from array or as result from Get-AdComputer
|
||||||
|
|
||||||
|
.OUTPUTS
|
||||||
|
|
||||||
|
Return PSCutomObject with Fields DNSHostName,ms-Mcs-AdmPwd,ms-Mcs-AdmPwdExpirationTime
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
|
||||||
|
PS> Get-ADLaps hostname
|
||||||
|
DNSHostName ms-Mcs-AdmPwd ms-Mcs-AdmPwdExpirationTime
|
||||||
|
----------- ------------- ---------------------------
|
||||||
|
hostname 47h4(44E 19.02.2022 09:28:15
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
|
||||||
|
PS> hostname | Get-ADLaps
|
||||||
|
DNSHostName ms-Mcs-AdmPwd ms-Mcs-AdmPwdExpirationTime
|
||||||
|
----------- ------------- ---------------------------
|
||||||
|
hostname 47h4(44E 19.02.2022 09:28:15
|
||||||
|
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
|
||||||
|
PS> Get-ADComputer hostname | Get-ADLaps
|
||||||
|
DNSHostName ms-Mcs-AdmPwd ms-Mcs-AdmPwdExpirationTime
|
||||||
|
----------- ------------- ---------------------------
|
||||||
|
hostname 47h4(44E 19.02.2022 09:28:15
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-ADLaps{
|
||||||
|
[CmdletBinding(DefaultParameterSetName="Identity")]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ParameterSetName="Identity",
|
||||||
|
Position = 0,
|
||||||
|
ValueFromPipeline = $true
|
||||||
|
)]
|
||||||
|
[string[]]$Identity
|
||||||
|
)
|
||||||
|
BEGIN{}
|
||||||
|
PROCESS{
|
||||||
|
foreach ($i in $Identity)
|
||||||
|
{
|
||||||
|
Get-ADComputer $i -Properties ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime | Select-Object DNSHostName,ms-Mcs-AdmPwd,@{name="ms-Mcs-AdmPwdExpirationTime";Expression={[datetime]::FromFileTime($_."ms-Mcs-AdmPwdExpirationTime")}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END{}
|
||||||
|
|
||||||
|
}
|
||||||
|
Export-ModuleMember -Function Get-ADLaps
|
Loading…
Reference in New Issue
Block a user