Forum Discussion
Kerslock
Jul 21, 2022Copper Contributor
Powershell Command for AD export
I have been searching for info, I am not even sure if what I am doing is feasible. All I want to do is export AD all computers. I have the command "Get-ADComputer -Filter "*" | Export-CSV -Path c:\Us...
farismalaeb
Jul 21, 2022Iron Contributor
HI
Try this code
$allPC=Get-ADComputer -Filter *
$Fullresult=@()
Foreach ($singlePC in $allPC){
$Result=[PSCustomObject]@{
Name=$singlePC.Name
Enabled=$singlePC.Enabled
BIOS=(Get-WmiObject Win32_BIOS -ComputerName $singlePC.name).SerialNumber
}
$Fullresult+=$Result
}
$Fullresult | export-csv -path C:\Myresult.csv