Forum Discussion
MatthewMcDonald_ews
May 20, 2022Brass Contributor
New-SMBMapping not showing in Explorer until Explorer process is closed/restarted
I'm writing a script to remap drives to new paths (file server migration), and I had everything working. I'm using Remove-SMBMapping and New-SMBMapping. While it was working there was a strange ...
MatthewMcDonald_ews
May 23, 2022Brass Contributor
No change. Anything I do within Powershell with drive letters is not reflected in the Explorer process.
Note: I am using Windows 11.
Further, I remember running into this problem a few months back but it only surfaced if I ever launched the script via the PS file from Explorer. If I launched it directly in Powershell, or simply manually typed the commands in Powershell it worked as expected. Now, all of a sudden, no matter what I do, if it's done in Powershell, Explorer will not see the change until it is restarted.
Note: I am using Windows 11.
Further, I remember running into this problem a few months back but it only surfaced if I ever launched the script via the PS file from Explorer. If I launched it directly in Powershell, or simply manually typed the commands in Powershell it worked as expected. Now, all of a sudden, no matter what I do, if it's done in Powershell, Explorer will not see the change until it is restarted.
May 23, 2022
I'm also using Windows 11, I typed the command in a Windows Terminal and.. Now it doesn't work for me also.. PowerShell 5 and 7 in Windows Terminal, but also from a script file... Which it did yesterday...I don't get it 🙂
- MatthewMcDonald_ewsMay 23, 2022Brass ContributorI'm glad I'm not the only one!!!
- MatthewMcDonald_ewsMay 23, 2022Brass ContributorI'm seeing some weird back and forth now. I am using Terminal too (as well as VSCode), where both were broken, so I decided to try regular Windows Powershell outside of Terminal. New-PSDrive works there, but only if I add the -Persist option. It also works with the raw NET USE command.
But after doing the, now New-PSDrive is working in Terminal\Powershell and Terminal\Windows Powershell again. I'm confused.
But New-SMBMapping still is broken everywhere (where it used to work).- May 23, 2022Adding persist does map it instant, remove-psdrive -Name X doesnt but net use x: /d does... But not running it from a script... It could work as a loginscript before the computer desktop is shown to the user I guess?