I was looking for a way to mount our HOME share without any warnings. So through my research I began to write my own Apple Script. I wanted to share this with everyone, as I had success with it so far. It is mainly to be used on computers not connected to AD, or laptops connected to AD with a mobile user account that do not have the UNC option selected (I found this option to be troublesome, as the share would not remap automatically when the user disconnected from the network and reconnected, https://jamfnation.jamfsoftware.com/discussion.html?id=10643). Eventually I would like to use something like Sleep Watcher to run this script. Right now I exported this script from Script Editor as an application and dropped it into composer from the Desktop, creating a .dmg. I enabled FUT and FEU so it would show up on every users desktop. My policy is simple, run mountHOMEshare.dmg and then execute command "defaults write /Library/Preferences/com.apple.finder ShowMountedServersOnDesktop -bool true". This forces the Finder Preferences to show Connected Servers on the desktop. When the user runs the application, it checks to see if it is on our network (WiFi, Hardwired directly or by a Thunderbolt adapter). If it isn't, it will give the user a simple warning. The warning may be removed when I decide to incorporate it into something like Sleep Watcher. I am currently deploying this policy through Self Service. Enjoy! Please feel free to share how you modified it to make it better, always room for improvement!
1--Mount Share--2--Made by Ian Lau--3--Modified 9/21/2015--45--Variables6property shareAddr : "smb://yourServer/yourShare"78--Eject yourShare if it is already mounted, to protect from mounting a duplicate--9tell application "Finder"10 try11 eject disk "yourShare"12 end try13end tell1415--Set SSID Variable to current network16--Set ethernet or thunderbolt IP instead17try18 set SSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"19 set ethernetDirectIP to do shell script "/usr/sbin/ipconfig getifaddr en0 2>&1 &"20 set thunderboltIP to do shell script "/usr/sbin/ipconfig getifaddr en4 2>&1 &"21end try2223--Check to see if you are on your company's Wifi network(s) or hardwired directly or through thunderbolt adapter24if SSID contains {"yourWifiNetworkName1"} then25 tell application "Finder"26 mount volume shareAddr27 end tell28else if SSID contains {"yourWifiNetworkName2"} then29 tell application "Finder"30 mount volume shareAddr31 end tell32else if ethernetDirectIP begins with "172." then33 tell application "Finder"34 mount volume shareAddr35 end tell36else if thunderboltIP begins with "172." then37 tell application "Finder"38 mount volume shareAddr39 end tell40else41 display dialog "You are not connected to your company's network" with icon caution42end if