Skip to content

Instantly share code, notes, and snippets.

@jasontucker
Created December 14, 2023 18:27
Show Gist options
  • Save jasontucker/853032649b85d2ef5e03a7f9f69ff35b to your computer and use it in GitHub Desktop.
Save jasontucker/853032649b85d2ef5e03a7f9f69ff35b to your computer and use it in GitHub Desktop.
# Get the current logged in user's username
$currentUser = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty UserName
$username = $currentUser.Split('\')[1]
# Build the UserPrincipalName
$userPrincipalName = $username + "@domain.net"
# Install the Upload-WindowsAutopilotDeviceInfo script
Install-Script -Name Upload-WindowsAutopilotDeviceInfo -Force -Confirm:$False
# Submit computer info to Intune for enrollment
Upload-WindowsAutopilotDeviceInfo.ps1 -TenantName "Tenant.onmicrosoft.com" -GroupTag "Pre-Provision" -UserPrincipalName $userPrincipalName -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment