Ho bisogno di ottenere uno script che mapperebbe le unità di rete in base al nome utente di una persona (usiamo AD per consentire l'accesso). Funzionava prima del 10.10.
Abbiamo un nuovo Mac Lab che esegue 10.12.6. Il vecchio script è sotto.
Ho installato jq da home-brew, ma continuo a ricevere un errore quando provo ad eseguirlo. (Anche sotto)
Scusa se non ho esperienza con AppleScript e sono completamente perso.
Qualsiasi aiuto sarebbe apprezzato
# Get Username and Tag Number. Define the URL for the json request.
set user to do shell script "whoami"
set tag to do shell script "hostname -s"
set link to "https://my.gprc.ab.ca/AppService/api/NetworkMappings?UserName=" & user & "&ComputerName=" & tag
# Get the number of disks currently mounted.
set diskLength to length of (list disks)
# Get number of records in the json object.
# Define the first record number in the object.
set recordLength to do shell script "curl " & quoted form of link & " | jq 'length'"
set recordNumber to 0
# For each json record, determine if the object is a drive or printer and mount/install accordingly.
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
e l'errore che ottengo è?
sh: jq: command not found
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 36 100 36 0 0 495 0 --:--:-- --:--:-- --:--:-- 500
(23) Failed writing body
sh: jq: command not found
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 36 100 36 0 0 495 0 --:--:-- --:--:-- --:--:-- 500
(23) Failed writing body (127)