Skip to main content
Question

Creating app shortcut through JAMF doesn't work but it works on manual creation

  • August 11, 2023
  • 0 replies
  • 12 views

Forum|alt.badge.img+1

Hi after installing app through JAMF when I am trying to create a shortcut by running this set of code.

-------------------------------------------macShortcut.py-----------------------------------------------------------------

from re import sub
from pyshortcuts import make_shortcut
import subprocess
import TPLogger as lg

user = subprocess.getoutput('ls -l /dev/console | cut -d " " -f4')
ruta_user = f'/Users/{user}/Desktop'
ruta_app = f'/Applications'
try:
    make_shortcut('/opt/ex_app.py', name='ex_app', icon='/opt/ex_app/Resources/Images/ex_app.icns',terminal=False, folder=ruta_user)
    make_shortcut('/opt/ex_app/ex_appscreen.py', name='ex_app', icon='/opt/ex_app/Resources/Images/ex_app.icns',terminal=False, folder=ruta_app)
except Exception as e:
    lg.log_info(e)
-----------------------------------------------------------------------------------------------------------------
sudo python3 /opt/ex_app/macShortcut.py
-----------------------------------------
When I create this shortcut/app.exe directly from the mac Terminal, the shortcut works but when I try to create it from jamf policy the shortcut gets created but when I try to run it. it shows blank screen with no information.