--- title: "透過 Intune 部署 macOS Agent" slug: "deploy-via-jamf-pro" description: "Automatically enroll macOS devices using Jamf Pro with HP Insights. Follow our guide for seamless configuration and deployment." updated: 2026-06-15T22:58:22Z published: 2026-06-15T22:58:22Z canonical: "learn.workforceexperience.hp.com/deploy-via-jamf-pro" --- > ## Documentation Index > Fetch the complete documentation index at: https://learn.workforceexperience.hp.com/llms.txt > Use this file to discover all available pages before exploring further. # 透過 Intune 部署 macOS Agent 本文介绍如何在 macOS 设备上使用 Jamf Pro 配置和部署 HP Insights macOS 代理。 ### 先决条件 1. 从 Workforce Experience Platform 获取公司范围的 PIN。 - 在平台的左侧菜单中,单击“ **设置** ”> **“首选项”** 选项卡> **“公司 Pin**”。 2. 从 https://workforceexperience.hp.com/software 下载最新的 HP Insights macOS 应用程序。 3. 下载并安装 Jamf Pro Installer.pkg 4. 根据以下选项复制并保存必要的脚本,以在 Jamf Pro 控制台中配置应用程序: - 如果设备不需要隐藏菜单栏的选项,请复制下面的 **Enrollment.sh**脚本文本。 - 如果设备需要隐藏菜单栏的选项,请复制下面的 **Enrollment_Tray.sh** 脚本文本。 - 如果设备已注册 HP Insights macOS 代理或自动升级到 macOS 版本 2.23.6,并且希望隐藏菜单栏图标,请复制下面的 **ShowTray.sh** 并 **HideTray.sh** 脚本文本。 > [!NOTE] > 如果设备已注册,请参阅下面的“已注册设备”安装部分。 ### 在 Jamf Pro 控制台中配置应用程序的脚本 1. **Enrollment.sh** - 此脚本将通过静默注册设备,无需用户交互。 - 需要在脚本中更新 CPIN。 1. **Enrollment_Tray.sh** (适用于 macOS 应用程序版本 2.23.6) - 此脚本将通过静默注册设备,无需用户交互。 - 这将隐藏托盘(菜单栏)。 - 需要在脚本中更新 CPIN。 1. **ShowTray.sh** (适用于 macOS 应用程序版本 2.23.6) - 此脚本将显示托盘(菜单栏)图标。 - 对于已注册 HP Insights 代理的设备,需要此脚本。 1. **HideTray.sh** (适用于 macOS 应用程序版本 2.23.6) - 此脚本将隐藏托盘(菜单栏)图标。 - 对于已注册 HP Insights 代理的设备,需要此脚本。 ### Enrollment.sh 脚本 在下面的脚本中,将“PIN”替换为实际的公司 PIN。 ```plaintext #!/bin/bash APPLICATION_SUPPORT_DIRECTORY=/etc/APMAgent PIN=######### if [ -d $APPLICATION_SUPPORT_DIRECTORY ] then echo "Directory Exists" else echo "Directory Does not exist, creating directory" mkdir "$APPLICATION_SUPPORT_DIRECTORY" fi echo "{\"PIN\":\"$PIN\"}" > "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" if [ "$APPLICATION_SUPPORT_DIRECTORY\enrollment.json" ] then echo "Successfully stored Data at $APPLICATION_SUPPORT_DIRECTORY/enrollment.json" cat "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" exit 0 else echo "Unable to store Data" exit 1 fi exit 1 ``` ### Enrollment_Tray.sh脚本 在下面的脚本中,将“PIN”替换为实际的公司 PIN。 ```plaintext #!/bin/bash APPLICATION_SUPPORT_DIRECTORY=/etc/APMAgent PIN=######### if [ -d $APPLICATION_SUPPORT_DIRECTORY ] then echo "Directory Exists" else echo "Directory Does not exist, creating directory" mkdir "$APPLICATION_SUPPORT_DIRECTORY" fi echo "{\"PIN\":\"$PIN\",\"HideTray\":\"true\"}" > "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" if [ "$APPLICATION_SUPPORT_DIRECTORY\enrollment.json" ] then echo "Successfully stored Data at $APPLICATION_SUPPORT_DIRECTORY/enrollment.json" cat "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" exit 0 else echo "Unable to store Data" exit 1 fi exit 1 ``` ### ShowTray.sh 脚本 ```plaintext #!/bin/bash APPLICATION_SUPPORT_DIRECTORY=/etc/APMAgent if [ -d $APPLICATION_SUPPORT_DIRECTORY ] then echo "Directory Exists" else echo "Directory Does not exist, creating directory" mkdir "$APPLICATION_SUPPORT_DIRECTORY" fi echo "{\"HideTray\":\"false\"}" > "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" if [ "$APPLICATION_SUPPORT_DIRECTORY\enrollment.json" ] then echo "Successfully create enrolment json at $APPLICATION_SUPPORT_DIRECTORY/enrollment.json" cat "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" exit 0 else echo "Unable to store PIN" exit 1 fi exit 1 ``` ### HideTray.sh 脚本 ```plaintext #!/bin/bash APPLICATION_SUPPORT_DIRECTORY=/etc/APMAgent if [ -d $APPLICATION_SUPPORT_DIRECTORY ] then echo "Directory Exists" else echo "Directory Does not exist, creating directory" mkdir "$APPLICATION_SUPPORT_DIRECTORY" fi echo "{\"HideTray\":\"true\"}" > "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" if [ "$APPLICATION_SUPPORT_DIRECTORY\enrollment.json" ] then echo "Successfully create enrolment json at $APPLICATION_SUPPORT_DIRECTORY/enrollment.json" cat "$APPLICATION_SUPPORT_DIRECTORY/enrollment.json" exit 0 else echo "Unable to store PIN" exit 1 fi exit 1 ``` ## 在 Jamf Pro 控制台中上传和配置应用程序 配置 HP Insights 代理会有所不同,具体取决于设备是在 HP Insights 代理中注册还是取消注册。可以在下面找到这两个迭代的说明: ### 未注册的设备 1. 在 **Jamf Pro** 控制台中,单击> **计算机** > **管理设置**。 2. 在 **“计算机管理”**下,选择 **“包”**。 3. 在 **“包”** 窗口中,单击 **“新建”** 以添加之前下载的 HP Insights macOS 应用程序包。 1. **显示名称:**输入包的名称 2. **类别**: 选择应用 3. **文件名**:上传 HP Insights macOS 应用程序包文件 4. 点击 **保存**。 5. 在 **“计算机管理”** 部分中,选择 **“脚本”**。 6. 在 **“脚本”** 窗口中,单击 **“新建”** 以添加 HP Insights 安装脚本。 1. **显示名称:**输入脚本名称 2. **类别**: 脚本 7. 点击 **保存**。 8. 单击 **“脚本”** 选项卡并复制上面选择的脚本。确保 脚本中的 替换为实际的公司 PIN。 9. 单击 **“选项”** 选项卡。 1. 在优先级中,选择 **之后** 10. 点击 **保存**。 11. 转到 **“计算机”** 选项卡,然后单击 **“策略”**。 12. 单击 **新建**。 1. 在 **“常规** ”部分中: 1. **显示名称:**输入策略的名称 2. 选中 **已启用** 3. **类别**: 选择 **应用** 4. **触发器**: **检查注册完成和定期签入** 2. 在 **“包** ”部分中,单击 **“配置**”。 1. 选择之前创建的包。 2. **分发点:**选择每台计算机的默认分发点 3. **作:**选择 **安装** 3. 在 **脚本** 部分中,单击 **配置**。 1. 选择之前创建的脚本。 2. **优先级**:选择 **之后** 3. 在 **“范围”** 选项卡中,根据需要定位设备。 4. 在**“自助服务**”选项卡中,**选中“在自助服务中使策略可用**” 5. **自助服务显示名称**:输入包的名称和描述 6. **按钮名称**:您还可以添加图标 13. 点击 **保存**。 ### 已注册的设备 如果设备已经安装了 HP Insights macOs 代理,并且用户想要切换隐藏菜单栏应用程序,则用户可以通过在控制台中运行 或 `ShowTray.sh` `HideTray.sh` 脚本来继续。该过程将与上面列出的“**尚未注册的设备**”相同;但是,在输入脚本时,输入 `sudo bash ./ShowTray.sh` 或 `sudo bash ./HideTray.sh` 分别。 使用 ShowTray.sh 或 HideTray.sh 时,无需提供 PIN。 ## **联系我们** 如需帮助,请创建[**支持案例**](/wxp/docs/zh-cn/creating-a-support-case)或发送电子邮件至 [**support@wxp.hp.com**](mailto:support@wxp.hp.com)。 ## Related - [Workforce Experience Platform 概述](/overview-of-workforce-experience-platform.md)