I have some automation scripts, but I had to split them down because of what appears to be an interesting bug. I've stripped it to its simplest form below:
Enter-PSSession [SERVER]
cd D:\
If I run the above in one go, I get the below error
cd : Cannot find drive. A drive with the name 'D' does not exist.
However, if I run the lines individually, they run fine. I have tried putting a sleep in for a second, a pause line, but still no luck. Is anyone else aware of this, and the way around it?