I have 2 scripts as follows:
Get-Content C:\Data\GetDescription\ComputerList.txt | Get-ADComputer -Property Name,Description |`
Select -Property Name,Description |`
Export-CSV C:\Data\GetDescription\ComputerList-Description.csv -NoTypeInformation -Encoding UTF8
Get-Content C:\Data\PingTest\ComputerList.txt | ForEach-Object{
$pingstatus = ""
IF (Test-Connection -BufferSize 32 -Count 1 -ComputerName $_ -Quiet) {
$pingstatus = "Online"
} Else {
$pingstatus = "Offline"
}
New-Object -TypeName PSObject -Property @{
Computer = $_
Status = $pingstatus }
} | Export-Csv C:\Data\PingTest\ComputerList-PingResults.csv -NoTypeInformation -Encoding UTF8
One gets the AD Description of the computers in the computer list. First column is name of computer and second column is the description.
The other does a test-connection and outputs the results. First column is name of computer and second column is the result of test-connection.
I want to combine them so that I have 3 columns. Name Description Result of Test-Connection.
These are my first 2 scripts and I mostly found all the code searching on Google, so I barely qualify as a beginner. Any tips on combining them?