I have the following code.
$strProjectPath="C:\temp\mps.xls";
$strServersExtr= @()
$strOSExtr= @()
$objServersList = New-Object PSObject
$objServersList | Add-Member -MemberType NoteProperty -Name ServerName -Value "" -PassThru | Add-Member -MemberType NoteProperty -Name OSType -Value ""
I read an Excel file (through a loop) to put 2 specific columns to these two members. The problem is that I can't add "Values" one after the other. += doesn't work with objects. I had try also to collect to and array and then to the object but it didn't work also. How is it possible to add lines to an already existing object?
Example:
ServerName OSType
---------- ------
blabla1 Windows XP
blabla2 Windows 7 Professional
PS1.The $strServersExtr and the $strOSExtr was an attempt to collect the 2 columns in the 2 arrays and then put them in to the object.
PS2. I work with PS 3.0 but any solution will be preferable as I try to make the code easy to work on PS 2.0.