Hello, not sure if this is possible since the script ends with kicking off mstsc but I"m trying to log computers that don't successfully connect. I was thinking of some kind of try catch implementation but cannot get that to work thus far.
Log for not connected/rejected machines would be extremely helpful.
Hello, your script is very usefull for me but when I try the public parameter mstsc asked me for credentials and don't use them provided in the command. If I don't use the public parameter the connection will be established but then windows saves the credential informations. I've used windows 10 for my tests with your script. Any ideas for getting the public parameter working for me and use the provided credentials in the command? Thanks for your help. Greetings Manuel
Hi Jaap, as usual, a nice script. However I'd like the password that I'm entering to be masked instead of appearing in clear text on my screen. Maybe build on the Get-Credential command or use some PSObject? krg, Erik
Hello, I have managed to incorporate your script in an automated function logging in and starting applications on dummy (automation) accounts. And it is working as a charm. But, as I try to use it in automated manner, an error handling would be useful. I have tried to use the standard .redirectStandardOutput property, but is is returning NULL $ProcessInfo.Fi leName = "$($env:SystemR oot)\system32\m stsc.exe" $ProcessInfo.Ar guments = ".\rld.rdp", "$MstscArgument s /v $Computer" $ProcessInfo.Wi ndowStyle = [System.Diagnos tics.ProcessWin dowStyle]::Norm al $processinfo.Re directStandardO utput = $true $Processinfo.Re directStandardE rror = $True $processinfo.Us eShellExecute = $false $Process.StartI nfo = $ProcessInfo if ($PSCmdlet.Shou ldProcess($Comp uter,'Connectin g mstsc')) { [void]$Process. Start() [pscustomobject ]@{ commandTitle = $commandTitle stdout = $process.Standa rdOutput.ReadTo End() stderr = $process.Standa rdError.ReadToE nd() ExitCode = $process.ExitCo de } And result is: commandTitle stdout stderr ExitCode ------------ ------ ------ -------- 0 In case of questions I use the rdl.rdp file to automatically start my application at logon and nothing else. Do you know any method to redirect the errors from mstsc.exe to this function output (like access denied, incorrect password etc.)?
If I wanted to add a custom parameter to remote desktop like I would in a standard .rdp file, is it possible to do this in the script? For example, I usually include smart sizing in my RDP sessions by adding "smart sizing:i:1" to the RDP file. Is there a way to turn on Smart Sizing via this script? Thanks.
Hello Jaap, This is a very useful script, thanks for making it. As we are using Remote Desktop Gateway, I added the following parameter: [Alias('GW')] [string] $Gateway and MstscArgument: {$Gateway} {$MstscArguments += "/g:$Gateway "} Please feel free to include it in your script as well. Best Regards, Csaba
Hello Guys, i working a lot with different VMs so i use the following stuff in my Powershell Profile: function cred() { $global:PSC = Get-Credential } function rdp() { param ([string]$a) if (!($PSC)) { cred } Connect-Mstsc -ComputerName $a -Credential $PSC -Width 1440 -Height 900 } As you can see it starts an RDP Session with specific settings. My Problem is that i cannot copy&paste files from or to this session. Only Text Copy/Paste is working. When i open an rdp session from my windows it is possibile to use copy/paste. Does anyone has a similar problem? Best regards, Michele
Is it possible to connect with IPv6 address (not FQDN or alike).
Hi Jaap, Sorry if this is a bit of an obvious question, I'm pretty new to PS. I'm trying to make a script has the credentials saved to open a remote session without any user input. I'm running this: Connect-Mstsc -ComputerName XXXX -User XXX\XXXXX -Password (ConvertTo-SecureString "XXXXXXXXXXXXXX XX" -AsPlainText -Force) When I run that script, it says the password is incorrect and a login box prompts me to enter the password, which then allows me to login. If I run the script without using ConvertTo-Secur eString then the script works ok, but I don't want to expose the password to the computer I'm logging into. Is there something I am doing wrong? If possible, I am looking to add a timeout after the user has remoted in. For example, the user would disconnect automatically after 10 seconds. Have you got any suggestions for the best way to accomplish this?
hey jbrowne91, you make and progress with this? I'm looking to accomplish the same task here^ and running into the same issue. Would greatly appreciate any recommendations/guidance if you've made some progress. Regards, Ry
This is probably a bit late, but for anyone else with the same problem, the answer is to not use the -name and -password options, use the -credential option instead. Create a $cred variable ($cred = get-credential 'domain(or computername if it's not in a domain)\user') and use that as the value for -credential (-credential $cred). You'll be prompted for the password in a popup and the encrypted information will be stored in the $cred variable.
Hi Jaap, Thanks for the script.. But can you please help me with the below scenario We have a daily task to check RDP is working fine for some 100 servers and it's logging into the server with out any issue. Can you please come with some dashboard kind of (html format) output to display which all are the servers not in network, profile loading issue, Connected succesfully. Also need to logoff from those 100+ server once completed Appreciate your help on this.. Thanks, Karthick