Posted on 11-20-2017 05:33 AM
Hi there
We have a couple dozen MAC's . We use to have a script that was a JQ script, that when someone logs into the MAC, a network share drive would log into it. Since the IOS went to 10.10+ this script doesn't work.
Each person has their own network drive (home directory) where they can save files. It would check the AD, and log into ANY and ALL network drives that the person is permitted to view.
It would also connect any network printer that the person is suppose to see.
the script below:
# Download ./jq and copy it to /usr/sbin (must use sudo).
et user to do shell script "whoami"
set tag to do shell script "hostname -s"
set link to "https://my.xxx.xxx.xx/AppService/api/NetworkMappings?UserName=" & user & "&ComputerName=" & tag
set diskLength to length of (list disks)
set recordLength to do shell script "curl " & quoted form of link & " | jq 'length'"
set recordNumber to 0
repeat recordLength times
# Define a variable pointing to the first record returned by list disks. # set diskItem to 1
try set networkPathVar to do shell script "curl " & quoted form of link & " | jq '.[" & recordNumber & "] | .NetworkPath' | cut -c 2- | sed 's:\\\\://:g' | sed 's:\\:/:g' | sed 's:.$::'" set deviceType to do shell script "curl " & quoted form of link & " | jq '.[" & recordNumber & "] | .Type'" on error return end try
if deviceType contains "Drive" then
set recordNumber to recordNumber + 1
# Check to see if the drive is already mounted. If not mount it.
# repeat diskLength times if networkPathVar does not contain items 1 thru diskLength of (list disks) then
mount volume "smb:" & networkPathVar
end if # end repeat
else
set recordNumber to recordNumber + 1
end if # End of Device Type IF
end repeat