0

I have a simple question concerning a Do loop running a RDP file (so the thin client always shows the login screen to enter credentials). Since we moved to Windows 2012 R2 RDS, I keep getting an infinite loop when launching the RDP file to connect to the RD Collection pool.

I am running:

Do  {
  Start-Process -wait c:\windows\system32\MSTSC.exe C:\Connection\Terminal-Server.RDP
}
while ($Process.Count -lt 1)

This will open up a RDP login where you can enter credentials. But it keeps opening ProcessNames for MSTSC, until the client crashes. The reason for this is the workspace id:s:Connection_broker.domain.local line. But I have no idea why, or how to get the process.count in order.

For some reason when using workspace id:s: in the file, the mstsc isn't noticed.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Andee
  • 11
  • 2
  • There was this bug report: [Powershell 3.0 Start-Process disregards -Wait Parameter when invoked Remotely](https://connect.microsoft.com/PowerShell/feedback/details/774903/powershell-3-0-start-process-disregards-wait-parameter-when-invoked-remotely). I'm not sure if that applies to you. The work around is to use Start-Process with PassThru and pipe to Wait-Process. You could try that. – Mike Zboray Jan 07 '15 at 07:34
  • I wrote a while-statement to execute the RDP file correctly. And an If statement to respond to closing or terminating the logon window. This is working fine. – Andee Sep 08 '15 at 10:36

0 Answers0