Once the application has been created and all the necessary information is available, you can start editing the scripts. The scripts can be saved on a USB stick and then started by right-clicking "Run as administrator".
The "right-click-_run_as_admin.bat" file executes the hwid.ps1 file in Powershell with administrator rights. This ensures that all necessary modules, etc. can be installed
right-click-_run_as_admin.bat
@setlocal enableextensions
@cd /d "%~dp0"
powershell.exe -executionpolicy bypass -file .\hwid.ps1
The file "hwid.ps1" contains the actual script, which needs to be slightly customised. XYZ must be filled with the values generated in the first part of the instructions.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$env:Path += ";C:\Program Files\WindowsPowerShell\Scripts"
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Confirm:$false -Force:$true
Install-Script get-windowsautopilotinfo -Confirm:$false -Force:$true
Get-windowsautopilotInfo -Online -TenantId XYZ -AppId XYZ -AppSecret XYZ
If you execute the BAT file on a computer, the computer or its hardware hash is uploaded directly to Intune.
The script and thus the degree of automation can be further customised if required. More on this in the last part of the instructions
The script accepts the following arguments
-AssignedComputerName [string]
-GroupTag [string]
-AssignedUser [string] (UPN of the user)
-Partner
-AddToGroup [string]
Example
Get-windowsautopilotInfo -Online -TenantId XYZ -AppId XYZ -AppSecret XYZ -AssignedComputerName Computer123 -GroupTag ComputerVertrieb -AssigendUser erica.musterfrau@schmittel-it.de