Created
May 27, 2024 16:52
-
-
Save alexishida/ad7a48b7edae0b02feb74610b7e63081 to your computer and use it in GitHub Desktop.
Find UDID from Apple Device on Windows ( Powershell )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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