title: How to take screenshot on remote desktop using powershell
body: <p>I have written a code, which is opening a browser and taking a screenshot. But when I running it through remote desktop, it's taking blank image.</p>
  <p>Can anyone suggest, how can I take the screenshot of browser on the remote desktop through PowerShell ?</p>
  <p>for e.g. I need to open <a href="https://stackoverflow.com/">https://stackoverflow.com/</a> on remote desktop and save screenshot in that remote server.</p>
  <p><strong>Code</strong>:</p>
  <pre><code>[Reflection.Assembly]::LoadWithPartialName(&quot;System.Drawing&quot;)
  function screenshot([Drawing.Rectangle]$bounds, $path) {
     $bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height
     $graphics = [Drawing.Graphics]::FromImage($bmp)
  
     $graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
  
     $bmp.Save($path)
  
     $graphics.Dispose()
     $bmp.Dispose()
  }
  </code></pre>