Not sure what happened. I just posted this and I don’t see it, so I’m posting again…
I’m trying to write a script to query a whole bunch of servers to look in a few different directories and find any files that match a pattern. Then I want that line appended to a file back on the server I am running the script on. When I run the script, I’m running it from 01 server and the array’s first item is 01… so it works. But, when it hits 02, it gets an access denied when trying to write back to 01.
Ignore the exit-pssession and remove-pssession. I was trying new-pssession instead of the invoke command earlier and not having any luck either. forgot to take it out.
I have heard of the double hop. I was first using the new-pssession and then exiting it. I was getting the error and that’s when I found the double hop issue. But, the website I found said to use the invoke-command instead to get around that.