A quick write up on a issue that was freaking me out. I have a management VM in our lab and was writing a script to automatically deploy a “Hyper Converged” system with Storage Spaces Direct remotely from the management VM.
I created a script that copies over the mastervhd and a custom module. It creates a new VM on the system, then it mounts the disk to add unattend file and some other files for the “run once” phase. Then I hit this error below when running it use a invoke-command cmdlet to one of the node in the converged system:
You see it cannot find the drive “t” when I try to add unattend and other scripts using the out-file command. Also the Get-PSDrive T didn’t return a success. But when I ran the good old cmdlet “tree” it did succeed. You see that at the line where it says “Folder PATH listing”. Hmmm… Ok. That’s weird. The funny thing is, when I run it on the box itself (local) it works flawless. So eventually my solution was to create a new PSDrive when running it in the invoke-command script. So in the function i added:
New-PSDrive -Name t -Root t:\ -PSProvider FileSystem
Now when I ran my script again:
It succeeded and created my VM: