目次
AutoPilotデバイスの登録をPower Shellからコマンド1つで完了させる方法
以前の記事のやり方の場合、一度CSVを出力し、出力したファイルをIntuneへインポートするという手順でしたが、
Upload-WindowsAutopilotDeviceInfoというコマンドを利用することで一度に登録までやってくれます。
下記手順でコマンドをインストールし、実行していきます。
install-script -Name Upload-WindowsAutopilotDeviceInfo PATH Environment Variable Change Your system has not been configured with a default script installation path yet, which means you can only run a script by specifying the full path to the script file. This action places the script into the folder 'C:\Program Files\WindowsPowerShell\Scripts', and adds that folder to your PATH environment variable. Do you want to add the script installation path 'C:\Program Files\WindowsPowerShell\Scripts' to the PATH environment variable? [Y] はい(Y) [N] いいえ(N) [S] 中断(S) [?] ヘルプ (既定値は "Y"): y Untrusted repository You are installing the scripts from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the scripts from 'PSGallery'? [Y] はい(Y) [A] すべて続行(A) [N] いいえ(N) [L] すべて無視(L) [S] 中断(S) [?] ヘルプ (既定値は "N"): a PS C:>
下記コマンドを実行する
PS C:\WINDOWS\system32> Upload-WindowsAutopilotDeviceInfo.ps1 -TenantName "example.com" -Verbose 詳細: Attempting to locate AzureAD module 詳細: AzureAD module detected, checking for latest version 詳細: Attempting to locate PSIntuneAuth module 詳細: Authentication module detected, checking for latest version 詳細: Checking for existing authentication token 詳細: Authentication token does not exist, requesting a new token 詳細: Gather device hash data from local machine 詳細: Constructing required JSON body based upon parameter input data for device hash upload 詳細: Attempting to post data for hardware hash upload @odata.context : https://graph.microsoft.com/beta/$metadata#deviceManagement/importedWindowsAutopilotDeviceI dentities/$entity id : XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX4 orderIdentifier : groupTag : serialNumber : 5CXXXXXXX productKey : WXXXX-XXXX-XXXXX-XXXXX importId : f9XXX-XXXX-XXXX-XXXXXXXXXXXX hardwareIdentifier : assignedUserPrincipalName : state : @{deviceImportStatus=unknown; deviceRegistrationId=; deviceErrorCode=0; deviceErrorName=} 詳細: Attempting to perform a sync action in Autopilot
しばらくするとWindows AutoPilotデバイスに表示されてきます
一発で登録されるので便利ですね!