I finally got it.
function Find-NumofTitles {
param (
[string]$drive
)
$bytes=Format-Hex "${drive}:\VIDEO_TS\VTS_01_0.IFO"
$d=($bytes|Select-String -Pattern "00000800")
$s="$d"
$s=$s.replace(" ","")
$s=$s.Substring(8,4)
[uint32]"0x$s"
}
You put the drive letter of the dvd without the colon (:) and then it'll tell you how many MAIN titles there are.