Mapping AD network user homes through OD
Our macs here used to be set up so users got their AD network home drives mapped when they login in when the path was in the following format in AD;
\\fileserver\username$
However to make adding new users easier for ourselves we changed the AD accounts so the home directory path is now as follows;
\\fileserver\users$\Students\YearGroup\username
This works fine in windows but on the macs it just maps users$ which they don't have permission to so..
Is there an easy way of fixing this?
I've written this applescript which ejects the users$ share, queries AD for the current users home directory, converts the \\ into / and maps that as an SMB share.
However i'm hoping there's an easier way of doing this that i've missed as i've got to apply this to around 100 macs..
Code:
set diskName to "users$"
tell application "Finder"
if disk diskName exists then
eject disk diskName
else
end if
end tell
set homedir to (do shell script "dscl /Active\\ Directory/domainname.org.uk -read /Users/$USER SMBHome | grep \\\\\\\\.* -o")
set x to SaR(homedir, "\\", "/")
on SaR(sourceText, findText, replaceText)
set {atid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, findText}
set tempText to text items of sourceText
set AppleScript's text item delimiters to replaceText
set sourceText to tempText as string
set AppleScript's text item delimiters to atid
return sourceText
end SaR
set networkhomedir to the result
mount volume "smb:" & networkhomedir as text
Any suggestions would be greatly appreciated.
Many thanks,
Martin