I finally got a good answer to this, than's to r/azure on reddit. I had trouble with some of the answers proposed here, not that they weren't good suggestions, just didn't seem to work for me.
$vm = Get-AzVm -ResourceGroupName 'wvd' -Name 'wvd-capture'
$scriptContent = @'
Start-Process -FilePath C:\Windows\System32\Sysprep\Sysprep.exe -ArgumentList '/generalize /oobe /shutdown /quiet'
'@
$execScriptName = 'Invoke-TempScript.ps1'
$execScriptPath = New-Item -Path $execScriptName -ItemType File -Force -Value $scriptContent | select -Expand FullName
$invokeParams = @{
VM = $vm
CommandId = 'RunPowerShellScript'
ScriptPath = $execScriptPath
}
$result = Invoke-AzVMRunCommand @invokeParams