Cannot get results needed from file last modified to CSV.

Can someone please help with this power-shell script. I am trying to get the out put of an array to report the results to a csv. This is the script and the results. Thank you in advance.

Script:
$Computers = Get-Content 'C:\powershell\list.txt'

Foreach ($Computer in $Computers) {
    set-location "\\$computer\c$\program files\nsclient++"
    if (Test-Path nsclient.ini) {
        $file = Get-Item  nsclient.ini
        $results += New-Object psObject -Property @{'Computer'=$computer;'FileName'=$file.FullName;'LastWriteTime'=$file.lastwritetime}
    }                
   else {
       $results += New-Object psObject -Property @{'Computer'=$computer;'FileName'="File not found";'LastWriteTime'="xx.xx.xx xx:xx:xx"}
    }
}
$results | select-object computer, LastWriteTime |out-file -append 'C:\powershell\filedateini.csv'

Results:
PS C:\powershell> C:\Powershell\getfiledate.ps1
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Powershell\getfiledate.ps1:7 char:9
+         $results += New-Object psObject -Property @{'Computer'=$compu ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 
set-location : Cannot find path '\\3MAPPPROD\c$\program files\nsclient++' because it does not exist.
At C:\Powershell\getfiledate.ps1:4 char:5
+     set-location "\\$computer\c$\program files\nsclient++"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (\\3MAPPPROD\c$\program files\nsclient++:String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
 
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Powershell\getfiledate.ps1:7 char:9
+         $results += New-Object psObject -Property @{'Computer'=$compu ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Powershell\getfiledate.ps1:7 char:9
+         $results += New-Object psObject -Property @{'Computer'=$compu ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Powershell\getfiledate.ps1:7 char:9
+         $results += New-Object psObject -Property @{'Computer'=$compu ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Powershell\getfiledate.ps1:7 char:9
+         $results += New-Object psObject -Property @{'Computer'=$compu ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At C:\Powershell\getfiledate.ps1:7 char:9
+         $results += New-Object psObject -Property @{'Computer'=$compu ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 

PS Microsoft.PowerShell.Core\FileSystem::\\CherwellDBDev\c$\program files\NSClient++>
Harrison AtenSystems EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
Try it like this:
Get-Content 'C:\powershell\list.txt' | ForEach-Object {
	$computer = $_
	Write-Host "Processing $($computer)"
	Try {
		Get-Item -Path "\\$($computer)\c$\program files\nsclient++\nsclient.ini" -ErrorAction Stop |
			Select-Object -Property @{n='ComputerName'; e={$computer}}, @{n='FileName'; e={$_.FullName}}, LastWriteTime, Error
	} Catch {
		$_.Exception.Message |
			Select-Object -Property @{n='ComputerName'; e={$computer}}, FileName, LastWriteTime, @{n='Error'; e={$_}}
	}
} | Export-Csv -NoTypeInformation -Path 'C:\powershell\filedateini.csv'

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Harrison AtenSystems EngineerAuthor Commented:
Thank you very much work as needed and we can close this post, I really appreciate the time and effort that you spent helping me with this issue. Good to be back at the exchange.
Harrison AtenSystems EngineerAuthor Commented:
Thank you very much work as needed and we can close this post, I really appreciate the time and effort that you spent helping me with this issue. Good to be back at the exchange.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.