$dcs = Get-Content C:\temp\server.txt
foreach ($dc in $dcs){
If ((Get-ADComputer -Filter 'Name -like $dc') -ne $null)
{
Get-ADComputer -Identity $dc -Properties * | Select-Object name,OperatingSystem | Export-Csv C:\temp\3.csv -Append -NoTypeInformation
}
else {
"$DC" |Select-Object @{name="Name";e={$Dc}},OperatingSystem | Export-Csv C:\temp\3.csv -Append -NoTypeInformation
}
}
No comments:
Post a Comment