Cross posting from: https://discussions.apple.com/thread/3196311?answerId=15810135022#15810135022
~~~~~~~~~~~
After several full Saturdays and Sundays chasing this down (and about 300 restarts), I have my Windows to Apple SMB Share connectivity issue narrowed down and worked around. This applies to OSx 10.7.0 and 10.7.1 on a MacMini (7/2011 Server w/SSD) with Shares under SMB, being connected to by Windows 7.
Basic Environment:
IF
1) you restart OSx and your Windows systems CANNOT connect because you get a prompt for userid/password or a not accessable message AND
2) after 2 or 3 minutes you can Start and Stop SMB Sharing with either Server.app (File Sharing) or Preferences/Sharing/File Sharing/Options/SMB on/off (individual IDs do _not_ have to be turned on / off) AND
3) the userid and password are exactly the same on both the client (Win7 or OSx) and the Sharing system AND
4) then Windows sytems can connect
Then the problem is a Race Condition in the Services Startup of OSx. The SMB service is dependent on some security process (guessing) which is completely late in the startup cycle.
You can test this with the following commands in a terminal window (AFTER the system is up and quiesced):
sleep 60
sudo serveradmin stop smb
sleep 5
sudo serveradmin start smb
After talking to Apple Enterprise Support to confirm the issue, I moved the above commands into a launchd script as a work around (this is NOT recommended unless you know what you're doing). Note the initial 60 second sleep - 30 seconds was not long enough. This has been filed with Apple Enginering, they'll figure out what to do about it going forward.
Part of my problem, is that I'm on a new MacMini (7/2011) which boots from local SSD, it just boots up too fast. If you're on a slower older system - this should not be an issue.
Some other things which I learned on this journey:
1) Do not use unload/load of the SMB plist - that does not work for this issue
2) OD accounts do not work. Wish they would, they dont
3) Hacking the windows registry as in previous versions to support the previous Samba SMB release (10.6.x and lower) is NOT the problem with any 10.7 release. OSx 10.7 Supports SMB2, as does Vista and Win7.