Please note the base and filter are just examples and not the actual code due to work place confidentiality. Code currently will pull from AD all computer name, then will run the ForEach command to get the NetAdapter Information. I am unable to get it to output to the CSV file however. Any advice would be great.
The idea is to NOT accumulate output into an array. That’s contrary to how PowerShell’s pipeline model works. So, I’ve written a function that simply lets the output into the pipeline one object at a time. I can then run that function and pipe its output to Export-CSV or whatever I like.
I suspect you’re not getting anything as-is because you’re not using -CimSession correctly. It doesn’t accept a computer name; it accepts a CIM Session.
in your code, what items do i need to change as i do not currently understand what you have written. I attempted to replace[String] in the $searchBase and now it just declares missing function perimeter list
From what I recall, doesn’t New-CimSession take an array of computernames as input? It should be possible to create session(s) for all machines at once, then feed that to Get-NetAdapter to do everything at the same time, rather than introducing unnecessary overhead with a loop.
Certainly valid. It’d be easier to add error-handling to it the way I originally had it, since you could trap any failed sessions individually and log them, but this also works if nothing goes wrong with the session creation.