title: Trying to convert powershell script to VBscript
body: <p>Figured it out with the help of Lee_Dailey &amp; js2010! Thanks fellas!</p>
  
  <p><strong>EDIT</strong>
  I am trying to figure out why I get a false positive when it's deployed through SCCM to a collection of computers. I get devices Non-Compliant when in fact they are. I was asked to provide the VB version of the script by the SCCM operators. I'm crossing off the potential causes.</p>
  
  <p>I am trying to convert the functionality of a PowerShell script to VBScript. The script checks for the AzureAdPrt token on a device but the challenge is with the output of that command, since it is formatted in a table and I only want to check a specific value. </p>
  
  <p>I attempted to replicate the technology to VBScript but I have no experience with it.</p>
  
  <p>Powershell Code:</p>
  
  <pre><code>    $dsregcmd = dsregcmd /status
      $PRTDetails = New-Object -TypeName PSObject
      $dsregcmd | Select-String -Pattern " *[A-z]+ : [A-z]+ *" | ForEach-Object {
                Add-Member -InputObject $PRTDetails -MemberType NoteProperty -Name (([String]$_).Trim() -split " : ")[0] -Value (([String]$_).Trim() -split " : ")[1]
           }
  $PRT_Status = ($PRTDetails).AzureAdPrt
  IF($PRT_Status -eq 'YES'){
      return $True
  }ELSE{
      return $False
  }
  </code></pre>
  
  <p>VB Code:</p>
  
  <pre><code>Set oShell = CreateObject ("WScript.Shell")
  oShell.run "cmd /c dsregcmd /status"
  IF oShell = "AzureAdPrt : YES"
    echo $true
  ELSE
    echo $false
  </code></pre>
  
  <p>What I am looking for is the VBScript to return $true if AzureAdPrt equals YES and $False if it's not.</p>