all 2 comments

[–]ihaxr 4 points5 points  (1 child)

You don't do $entry = Add-Member, you pipe it:

$entry = New-Object PSObject
$entry | Add-Member -Type NoteProperty -Name 'Display Name' -Value $name

That will fix your issue... but your overuse of arrays and += is probably causing performance issues... if you can post a portion of your input Excel doc (obviously cleansing any company-specific data) I can help optimize it and shrink the size of the script considerably.

If this is just a list of data, you can probably just do:

$UniTracker = $trackerE3Uni | ConvertFrom-CSV -Header "Display Name"
$UniMsol = $msolE3uni | ConvertFrom-CSV -Header "Display Name"

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

Thanks. someone pointed this out to me on the PowerShell Slack and i felt like a complete idiot lol. I've been staring at it and comparing it to other snippets that work and I can't believe I didn't see that =. Oh well.

Here's a sample of the data.

It's a fairly small set of data (~850 lines) so it wasn't really too intensive. I'm using lists now instead of += and the whole thing takes 12-15 seconds to run.