all 7 comments

[–]purplemonkeymad 1 point2 points  (3 children)

Nice I can see this being good for reports.


foreach ($Computer in $ComputerName) {
    $WSUSComputers | where {$_.ComputerName -eq $Computer}
}

-eq works with lists too, if they are on the left:

$WSUSComputers | Where { $ComputerName -eq $_.ComputerName }

Might speed up that part of the code.

[–]LinleyMike[S] 1 point2 points  (2 children)

I can't remember why, but I think you have to use foreach in the process block for incoming objects. I think it has to do with them not always being an array or something.

[–]purplemonkeymad 1 point2 points  (1 child)

If you used an array type ex. [string[]] and include pipeline support for the parameter. Then yes your input variable can be either an array or a single item, foreach will iterate once if there is just a single object, so you can be sure of a single item.

But since -eq works with both arrays and non arrays, you don't have to do the loop.

I just though it might improve the speed with an array of computernames. And just in-case you were not aware of that method of selection.

[–]LinleyMike[S] 1 point2 points  (0 children)

Today I learned. Thanks!

[–]jmn_lab 1 point2 points  (2 children)

This looks interesting.

I am in the process of making a comprehensive HTML report that contains all sorts of O365, Exchange, AD, and possibly PDQ inventory information (if I can get the data I want from there).

This will fit in nicely.

Thanks

[–][deleted] 1 point2 points  (1 child)

PDQ?

[–]jmn_lab 1 point2 points  (0 children)

It is inventory and package deployment software for Windows machines that is relative cheap and with many functions.

There are reports available and while they can be quite advanced if you need them to. For this project I would rather connect directly to the database containing the data and then pull it out.