使用 Google Apps 脚本重置带有 SDK 的托管 Chrome 设备
Reset a Managed Chrome Device with SDK using Google Apps Script
我正在尝试为管理员创建一个仪表板,以允许他们使用 google 应用程序脚本重置由 GoogleAdmin 管理的 chrome 设备。
我看不到任何使用 Admin SDK 执行重置的方法 API。这能做到吗?
如果您想取消配置 and/or 禁用 ChromeOS 设备
根据文档 here,使用目录 API 时支持的操作是:
deprovision
: Remove a device from management that is no longer active, being resold, or is being submitted for return / repair, use the deprovision action to dissociate it from management.
disable
: If you believe a device in your organization has been lost or stolen, you can disable the device so that no one else can use it. When a device is disabled, all the user can see when turning on the Chrome device is a screen telling them that it’s been disabled, and your desired contact information of where to return the device.
考虑到这一点,请求将是这样的:
POST https://admin.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{resourceId}/action
如果你想重启 and/or 远程 powerwash ChromeOS 设备
但是,如果您只是打算做一个 powerwash
或 reboot
,您可以使用以下信息:
REBOOT
: Reboot the device. Can only be issued to Kiosk and managed guest session devices.
REMOTE_POWERWASH
: Wipes the device by performing a power wash. Executing this command in the device will remove all data including user policies, device policies and enrollment policies.
Warning: This will revert the device back to a factory state with no enrollment unless the device is subject to forced or auto enrollment. Use with caution, as this is an irreversible action!
考虑到这一点,请求将是这样的:
POST https://admin.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}:issueCommand
Apps 脚本
至于在 Apps 脚本中应用任何这些,您必须添加 Admin SDK API 高级服务并选择 directory _v1
版本和模拟上述任何一个请求。
代码
假设你想远程 powerwash 一个设备,你将不得不写类似这样的东西:
let resource = {
YOUR_RESOURCE_HERE;
"commandType": "REMOTE_POWERWASH"
};
let customerId = 'CUSTOMER_ID';
let deviceId = 'DEVICE_ID';
AdminDirectory.Customer.Devices.Chromeos.issueCommand(resource, customerId, deviceId);
不是您要查找的内容?
您可以简单地在 Google 的问题跟踪器上创建功能请求,并通过填写表格 here.
提供与您的任务相关的详细信息
参考
我正在尝试为管理员创建一个仪表板,以允许他们使用 google 应用程序脚本重置由 GoogleAdmin 管理的 chrome 设备。
我看不到任何使用 Admin SDK 执行重置的方法 API。这能做到吗?
如果您想取消配置 and/or 禁用 ChromeOS 设备
根据文档 here,使用目录 API 时支持的操作是:
deprovision
: Remove a device from management that is no longer active, being resold, or is being submitted for return / repair, use the deprovision action to dissociate it from management.
disable
: If you believe a device in your organization has been lost or stolen, you can disable the device so that no one else can use it. When a device is disabled, all the user can see when turning on the Chrome device is a screen telling them that it’s been disabled, and your desired contact information of where to return the device.
考虑到这一点,请求将是这样的:
POST https://admin.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{resourceId}/action
如果你想重启 and/or 远程 powerwash ChromeOS 设备
但是,如果您只是打算做一个 powerwash
或 reboot
,您可以使用以下信息:
REBOOT
: Reboot the device. Can only be issued to Kiosk and managed guest session devices.
REMOTE_POWERWASH
: Wipes the device by performing a power wash. Executing this command in the device will remove all data including user policies, device policies and enrollment policies. Warning: This will revert the device back to a factory state with no enrollment unless the device is subject to forced or auto enrollment. Use with caution, as this is an irreversible action!
考虑到这一点,请求将是这样的:
POST https://admin.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}:issueCommand
Apps 脚本
至于在 Apps 脚本中应用任何这些,您必须添加 Admin SDK API 高级服务并选择 directory _v1
版本和模拟上述任何一个请求。
代码
假设你想远程 powerwash 一个设备,你将不得不写类似这样的东西:
let resource = {
YOUR_RESOURCE_HERE;
"commandType": "REMOTE_POWERWASH"
};
let customerId = 'CUSTOMER_ID';
let deviceId = 'DEVICE_ID';
AdminDirectory.Customer.Devices.Chromeos.issueCommand(resource, customerId, deviceId);
不是您要查找的内容?
您可以简单地在 Google 的问题跟踪器上创建功能请求,并通过填写表格 here.
提供与您的任务相关的详细信息