We help IT Professionals succeed at work.

How to remove the warning "Publisher of this remote connection cannot be identified"

Jasmin01
Jasmin01 asked
on
Medium Priority
5,267 Views
Last Modified: 2013-11-21
Hi,

I have a script that allows me to create a RDP.  When the user clicks on this RDP, I need the user to de directed into the RDP, without the warning: "The publisher of this remote connection cannot be identified.  Do you want to connect anyway?"  I would like the checkbox "Dont ask me again for connections to this computer" to be ticked, and to have the "Connect" button automatically ticked.  I would like the same to be done to the next warning: "The identity of the remote computer cannot be verified.  Do you want to connect anyway?".  Is there a script that can do this?
Comment
Watch Question

Author

Commented:
Thanks

Commented:
Just to add, you could very easily script this with AutoIt, it will tick checkboxes and click buttons for you, its interacts with form controls using COM.

Author

Commented:
Can you give me more information about it?

Commented:
I will write a very simple AutoIt script for you when I get off work, 8-9 hours.

Author

Commented:
Thanks

Commented:
Alright, here we go:

Did this in 10 minutes, so its not pretty, but it does the job. I can add a GUI with history etc if you really want me to...

Tested only on Win7, works only on english systems.

You can download the compiled exe here: LINK

Or paste the source into AutoIt and compile it yourself.

This is the source:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\RDPConnect.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Opt("MustDeclareVars", 1)
Global $RDPhost

call_RDPclient()
close_warnings()

Func call_RDPclient()

	$RDPhost = InputBox("", "Please enter the RDP host to connect.")
	Run(EnvGet("windir") & "\system32\mstsc.exe /v:" & $RDPhost & "")
EndFunc   ;==>call_RDPclient

Func close_warnings()

	; infinate loop
	While 1 = 1
		If WinExists("Remote Desktop Connection", "The remote computer could not be authenticated") Then
			;This clicks the needed button to get rid of "The remote computer could not be authenticated" warning
			ControlClick("Remote Desktop Connection", "The remote computer could not be authenticated", "Button3")
			ControlClick("Remote Desktop Connection", "The remote computer could not be authenticated", "Button5")
		EndIf

		If WinExists("Remote Desktop Connection", "This problem can occur if the remote computer is running") Then
			;This clicks the needed button to get rid of warning when connecting to Win XP or Server 2003 hosts
			ControlClick("Remote Desktop Connection", "This problem can occur if the remote computer is running", "Button1")
			ControlClick("Remote Desktop Connection", "This problem can occur if the remote computer is running", "Button2")
		EndIf

		If WinExists($RDPhost & " - Remote Desktop Connection", $RDPhost & " - Remote Desktop Connection") Then
			ExitLoop
		EndIf
		;prevent 100% CPU usage
		Sleep(250)
	WEnd
EndFunc   ;==>close_warnings

Open in new window