1
General Software Discussion / Re: [Win][Suggestions needed] Ensure network shares are connected reliably at login?
« on: January 06, 2019, 06:11 PM »
So I searched a bit more and came across this, with the 'net use' command mentioned here. With modification, it seems to work, and is quick enough on login to work; again, I don't know much about much beyond single-line shell commands; is this the proper way of doing this? I also had saved the login credentials when I initially set the shares up (not sure if that's separate from the credential manager)..
I'm also still using the machine name over the IP here, and it doesn't *seem* to matter - I have almost 40 devices on my network, but the NAS has a static IP via the router.. (I was using the IP as posts about similar questions said that it was recommended as a solution for this initial issue, but it made no difference in the mapped shares, so I switched back).
I imagine there are differences between cmd and ps, and so this doesn't have the retry function/I am in no way skilled with either tool to try and combine them, which is unfortunate, but initial tests seemed to work for me.
Thoughts?
I'm also still using the machine name over the IP here, and it doesn't *seem* to matter - I have almost 40 devices on my network, but the NAS has a static IP via the router.. (I was using the IP as posts about similar questions said that it was recommended as a solution for this initial issue, but it made no difference in the mapped shares, so I switched back).
@echo off
:Start
timeout /t 1 /nobreak >NUL
if exist W:\ X:\ Y:\ Z:\ NUL goto End
net use W: \\NAS\backups /PERSISTENT:YES
net use X: \\NAS\homes /PERSISTENT:YES
net use Y: \\NAS\media /PERSISTENT:YES
net use Z: \\NAS\temp /PERSISTENT:YES
if ERRORLEVEL 1 goto exit
:End
:Start
timeout /t 1 /nobreak >NUL
if exist W:\ X:\ Y:\ Z:\ NUL goto End
net use W: \\NAS\backups /PERSISTENT:YES
net use X: \\NAS\homes /PERSISTENT:YES
net use Y: \\NAS\media /PERSISTENT:YES
net use Z: \\NAS\temp /PERSISTENT:YES
if ERRORLEVEL 1 goto exit
:End
I imagine there are differences between cmd and ps, and so this doesn't have the retry function/I am in no way skilled with either tool to try and combine them, which is unfortunate, but initial tests seemed to work for me.
Thoughts?