Skip to content

Instantly share code, notes, and snippets.

@alexishida
Created May 27, 2024 16:52
Show Gist options
  • Save alexishida/ad7a48b7edae0b02feb74610b7e63081 to your computer and use it in GitHub Desktop.
Save alexishida/ad7a48b7edae0b02feb74610b7e63081 to your computer and use it in GitHub Desktop.
Find UDID from Apple Device on Windows ( Powershell )
# Find UDID from Apple Device
# Date: 27/05/2024
# Source: https://joe-bologna.medium.com/obtain-ios-udid-using-usb-and-windows-powershell-a9648fc9b425
if ($args.Count -ge 1) {
$appledevice = $args[0]
} else {
$appledevice = "Apple Mobile"
}
$devicedata = (Get-WmiObject -Class Win32_PnpEntity -Namespace "root\CIMV2" -Filter "Name like '$appledevice%'")
if ($devicedata.PNPDeviceID.Length -gt 0) {
$deviceid = $devicedata.PNPDeviceID.Substring(22)
if ($args.Count -eq 2) {
$left = $deviceid.substring(0,8) -replace "[0-9A-F]",$args[1]
} else {
$left = $deviceid.substring(0,8)
}
$right = $deviceid.substring(8)
$udid = "$left-$right"
Write-Output $udid
} else {
Write-Warning "Device Like '$appledevice' Not Found"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment