I have a problem with server access:

I have a problem with server access:

I’ve been using a Mac mini M1 16 Gb with a Synology NAS for eight years. Until recently, I used AFP as the server access protocol. Apple is discontinuing AFP in 2026/2027 and switching to SMB. I can easily switch from AFP to SMB on the Synology NAS, but I never had any mapping problems with AFP before.
Now, under SMB, I regularly get incorrect mappings, or I can’t find the server.
I’ve used Apple Script to fix this, but it doesn’t always work.

System: In the Finder, I connect to server: SMB://ServerName. Under System, General, Login Items, the following script (login.app) is loaded.

Example of my login.app script:

delay 15
tell application "Finder"
	try
		mount volume "smb:// (servername)/Name 1"
		mount volume "smb:// (servername)/Name 2"
		mount volume "smb:// (servername)/Name 3"
		mount volume "smb:// (servername)/Name 4"
		mount volume "smb:// (servername)/Name 5"
		mount volume "smb:// (servername)/Name 6"
	end try
	open disk "Name 1"
	open disk "Name 2"
	open disk "Name 3"
	open disk "Name 4"
	open disk "Name 5"
	open disk "Name 6"
end tell

tell application "Finder"
	close every window
end tell

What am I doing wrong here, or what can I add to make it work correctly every time?

What version of SMB does the Synology have?

It’s a Synology DS 418 with DSM 6.2.4.25556 update 8, with SMB 2 and a large MTU, and the option to switch to SMB 3.
I also have the option to update to DSM 7.2.1 with SMB version 4.15.

Try SMB 3, as I believe that is the version Apple uses

Setup SMB 3 and it works much better and faster. I can also connect TimeMachine to the NAS again. Thanks a lot for the solution.

I’m glad you resolved your issues by moving to SMB 3. Regardless, perhaps a bit of pausing and checking as you proceed through the process of mounting multiple volumes might be advisable?

delay 15

tell application "Finder"
	set serverSMB to "smb://servername/"
	set volumeNameList to {"Name 1", "Name 2", "Name 3", "Name 4", "Name 5", "Name 6"}
	repeat with indx from 1 to length of volumeNameList
		set thisServerVolume to ("" & serverSMB & (item indx of volumeNameList))
		
		set attempts to 0
		repeat
			try
				mount volume thisServerVolume
			end try
			set mountedVolumeList to paragraphs of (do shell script "ls /Volumes/")
			if mountedVolumeList contains item indx of volumeNameList then exit repeat
			set attempts to attempts + 1
			if attempts > 10 then exit repeat
			delay 1
		end repeat
		
		open disk (item indx of volumeNameList)
	end repeat
end tell


tell application "Finder"
	close every window
end tell

I’ve never used Synology products myself, so this is just an idea.
It might be worth trying the hostname with “.local” appended for Bonjour.
Just for your reference.

# Without percent-encoding
set strURL to ("smb://SERVERNAME/Name 1") as text
# With .local for Bonjour
set strURL to ("smb://SERVERNAME.local/Name 1") as text

# With percent-encoding
set strURL to ("smb://SERVERNAME/Name%021") as text
set strURL to ("smb://SERVERNAME.local/Name%021") as text

# For GUEST No PW
set strURL to ("smb://guest:@SERVERNAME/Name%021") as text
set strURL to ("smb://guest:@SERVERNAME.local/Name%021") as text

Dear Paulskinner and Icefole, I’m very grateful for your help and scripts, but at the moment, switching to SMB 3 has worked fine here, and everything is back to normal.
A wise man once told me: never change a working system (lol), and as much as I’d love to try your scripts, I’ll wait a bit longer to see if everything continues to work normally for me.
Thanks again for the help.