Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.7k stars 1.08k forks source link

DisableSMBServer breaks Shared Drives (mounted volumes) in Docker for Windows #216

Closed mhujer closed 5 years ago

mhujer commented 5 years ago

I'm creating this issue to have the Google index the error message.

Enabling the DisableSMBServer rule breaks Shared Drives (mounted volumes) in Docker for Windows.

If you are trying to enable Shared Drives in Docker and the drive checkbox won't stay checked, you probably have this in the Docker error log (c:\Users\%USERNAME%\AppData\Local\Docker\log.log)

[19:30:22.317][SambaShare     ][Error  ] Unable to mount C drive: 10.0.75.1 (10.0.75.1:445) open
rm: cannot remove '/c': No such file or directory
rm: cannot remove '/C': No such file or directory
umount: /host_mnt/c: not mounted.
mount.cifs kernel mount options: ip=10.0.75.1,unc=\\10.0.75.1\C,noperm,iocharset=utf8,dir_mode=0777,nobrl,mfsymlinks,vers=3.02,sec=ntlmsspi,user=myuser,domain=mydomain,pass=********
mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

The solution is either to remove HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\SMB2 key or change its value to 1

https://github.com/Disassembler0/Win10-Initial-Setup-Script/blob/b3b12239ecae4143f908d547ff3210027a32ad94/Win10.psm1#L532-L537

Maybe a note can be added to the code so the others are spared of this :-)

Disassembler0 commented 5 years ago

The tweak is not as part of the default preset, you have to run it explicitly, in which case FAQ Q/A 1 goes double for you. Moreover it already has a note stating "Completely disables file and printer sharing" which should be pretty self-explanatory, especially when it comes to shared drives.

mhujer commented 5 years ago

@Disassembler0 thanks for the answer. I'm definitely not blaming the tool, i just blame myself for using it wrong.

I wasn't using Docker when I created my preset so it did not occur to me, that it may break it. See the PR #217 which adds the note with warning.