title: Powershell scipt to open power point and play slide show
body: <p>Hey Can any one tell me how to open power point and play slide show </p>
  
  <p>I have the following code but it isnt working</p>
  
  <pre><code>$ppAdvanceOnTime = 2
   $ppShowTypeKiosk = 3
   $ppSlideShowDone = 5
  
  Add-type -AssemblyName office
  $Application = New-Object -ComObject powerpoint.application
  $application.visible = [Microsoft.Office.Core.MsoTriState]::msoTrue
  $path = "C:\Users\asuribha\Desktop\Web.pptx"
  
  
  
   $presentation = $application.Presentations.open($path)
  
  $presentation.SlideShowSettings.AdvanceMode = $ppAdvanceOnTime 
  $presentation.SlideShowSettings.ShowType =  $ppShowTypeKiosk 
  
  $presentation.SlideShowSettings.StartingSlide = 1
  $presentation.SlideShowSettings.EndingSlide = $presentation.Slides.Count
  
  Do
   {
      $presenatation.SlideShowSettings.Run.View.
      if (Err&lt;&gt;0)
      {
          Exit Do
      }
  
  }       
  
   until ($presenatation.SlideShowSettings.Run.View.State = $ppSlideShowDone)
  
  
  
  
  
  
  $application.quit()
  
  [gc]::collect()
  [gc]::WaitForPendingFinalizers()
  </code></pre>
  
  <p>This code opens power point but doesnt play the slide show !!! I also have a problem with this it sometimes automatically closes the power point.
  Please Help me out with this</p>