Simple array in PowerShell script
Here is a baseline of nested arrays in PowerShell script:
PS: Currently output is not sorted, looking for improvements:
PS: Currently output is not sorted, looking for improvements:
<#
JD Script to find Last logon time
#>
$array = @()
foreach ($ID in $IDs) {
$User = Get-ADUser -Server $dc -Filter {Name -like $ID} -Properties *
$obj = New-Object psobject -Property @{
Name = $User.Name
LastLogonDate = $User.LastLogonDate
}
$array += $obj
}
#$array | Select * | FT -AutoSize
$array | Export-Csv -path $outfile -NoTypeInformation
Comments
Post a Comment