Hey guys,
This is my first JAMFNation post so bare with me and the enormous novel. I'm having an issue with mounting network shares, but not really in a traditional way. I'll explain a bit of background. Please tell me I'm over thinking this and that there's a really easy solution :)
What we'd like to have is users to log in and be able to see their own individual network share mounted on the desktop. Their individual network share with their name. One of our previous sysadmins set up our network shares.. not so well, so here is the structure and what we're trying to achieve:
The user's individual folders are located within a network share with a space in the name, let's call it: Users A. They log into domain bound macs with the username format: Firstname.Lastname, but their individual network shares were set up as FirstName<space>LastName (yeah, don't ask me why).
So say I'm accessing my individual network share, it would be smb://my.company.com/Users A/John Doe. If I mount this most traditional ways, it will only mount the Users A folder on the desktop instead of the John Doe folder straight to the desktop. I modified the mountNetworkShares.sh script and this is what happened. So if you do CMD + K and type in smb://my.company.com/Users%20A/John%20Doe/ you would get Users A on the desktop as well.
I wrote the following bash script which resolves the issue... sort of. I have a policy scoped for users that would be associated with the Users A and did an ongoing login policy that runs this bash script:
#!/bin/sh
name=$3
nameSpace=${name/./'%20'}
type=" -type smb"
jamf mount -server 'my.company.com/Users%20A/'$nameSpace$type
So the script takes in the $3 variable at login, which would be john.doe. The script then replaces the period with %20, resulting in john%20doe and leverages the jamf mount command (which I found will actually mount the individual's folder rather than the Users A folder) to mount the drive. This script runs perfectly if I'm logged in and run the command from the terminal. I review the error in the JSS and I see the following:
Script Result: Mounting smb://my.company.com/Users%20A/john%20doe/ to /Volumes/ 1...
There was an error mounting the file server smb://my.company.com/Users%20A/john%20doe/. Will attempt again.
As I said before, I ran this script while logged in and it worked perfectly. If I do a CMD + K and copy/paste: smb://my.company.com/Users%20A/john%20doe/ , it's able to mount (but like I said, it only mounts the Users A folder). If I do a jamf mount -server 'my.company.com/Users%20A/john%20doe/' -type smb, it's also able to mount the network share just fine. It's obviously getting the $3 variable at login and doing the correct operations to make it john%20doe, it's just reporting back an error and not actually mounting the drive.
Any insight would be greatly appreciated. Sorry again for the long novel, but I'm at a loss and figured I would put this out to the braintrust for alternate methods / ideas.