Necesito obtener un script que asigne unidades de red según el nombre de usuario de una persona (usamos AD para permitir el acceso). Solía funcionar antes de las 10.10.
Tenemos un nuevo laboratorio de Mac que está ejecutando 10.12.6. El script anterior está abajo.
He instalado jq desde home-brew, pero continúo recibiendo un error cuando intento ejecutarlo. (También abajo)
Lo siento, no tengo experiencia con AppleScript y estoy totalmente perdido.
Cualquier ayuda sería apreciada
# 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
y el error que recibo es?
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)