Scenario: I have a PsRemote Session Configured and Operational from my domain to a VM on Azure which is a WORKGROUP Computer. I have a script located on my Azure VM which I run from my Domain computer using PsRemote session, it reads some text files and returns the results on my computer screen.
Problem: I want those results to be written in a file on my Source/Domain Computer rather than displaying in PowerShell console.
Select-String -Path C:\sometextfile.txt -Pattern "Search pattern" | select linenumber,line |` Export-Csv -Path '\\destinationIP\d$\results.csv' -NoTypeInformation
Error: Access Denied
When I try to write results in a file on my computer it produces the aforementioned error.