title: Find the mapped google drive
body: <pre><code>If (!(Get-PSDrive R -PSProvider FileSystem -ErrorAction SilentlyContinue)) {
      #this function checks for the latest exe of google drive.  Then tries to start it.
      Import-Module C:\Tasks\Modules\Find-LatestFileVersion\Find-LatestFileVersion.psm1
      $GdfsPath = Find-LatestFileVersion -fileName &quot;GoogleDriveFS.exe&quot; -filePath &quot;$Env:Programfiles\Google&quot;
      Try {
          Start-Process $GdfsPath.FilePath | Wait-Process -Timeout 30
      }
      Catch {
          Write-Warning &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
  
          $mailBody = &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
          $mailSubject = &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
         
          Send-MailMessage @MailArguments -to $ENV:BUILD_USER_EMAIL -Subject $mailSubject -Body $mailBody
          throw &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
      }
      Finally {
          If (!(Get-PSDrive R -PSProvider FileSystem -ErrorAction SilentlyContinue)) {
              Write-Warning &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
  
              $mailBody = &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
              $mailSubject = &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot;
             
              Send-MailMessage @MailArguments -to $ENV:BUILD_USER_EMAIL -Subject $mailSubject -Body $mailBody
              throw &quot;Drive R to Google Drive can't be mapped. $Email failed to record seperation.&quot; 
          }
      }
  }
  </code></pre>
  <p>Above tests if the drive is mapped. If not tries to start Google Drive and then tests again.</p>
  <p>The big issue is the assumption that google drive is the R: drive. There does not seem to be a command line that will start google drive with a drive letter or a means to test if a drive letter is a google drive.</p>
  <p>Thoughts?</p>