Output of powershell script not working correctly?
Ok, so I've been working on a script for work for a day or two. I'm very new to powershell but learning slowly. I've trimmed down a script I bought. Basically the ONLY thing I need to do is get the NIC model or description from all of the remote servers on our forest. Which is close to 1k. The script currently works, however it outputs 4 times for every host name or IP.
What am I doing wrong here? Here is the script.
It looks like you have more problems then duplicates. You're looping a FILEPATH(char array, $ipaddresses).
Try something like this:
$infile = Read-Host 'What is the path of your call file (absolute path, ex. "c:\test\file.txt")?' $servers = Get-Content $infile $outfile = Read-Host -Prompt 'Please specify the path at which you would like ot save your file. (CSV)' New-Item $outfile -ItemType File -Force Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $servers | Select-Object PSComputerName, Description | Export-Csv $outfile -NoTypeInformation -Delimiter ";" Invoke-Item $outfile Read-Host -Prompt 'Your file has been saved at your destination, Good bye'