Reputation: 543
I'm trying to automate the steps below using powershell. I'm able to perform Step1
I'm not able to perform Step2 in powershell. Any ideas or suggestions are welcomed.
Upvotes: 1
Views: 2494
Reputation: 543
I did this with the below code:
Step#1 is done as mentioned in the below URL: https://gallery.technet.microsoft.com/scriptcenter/Connect-Mstsc-Open-RDP-2064b10b
Step#2: Done with the below code.
[system.Reflection.Assembly]::LoadWithPartialName("####TITLE OF THE WINDOW####") | out-null
# Set the exactly position of cursor in some iexplore hyperlink between the (open parenthesis) below:
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(790,675)
Click-MouseButton
function Click-MouseButton
{
$signature=@'
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
'@
$SendMouseClick = Add-Type -memberDefinition $signature -name "Win32MouseEventNew" -namespace Win32Functions -passThru
$SendMouseClick::mouse_event(0x00000002, 0, 0, 0, 0);
$SendMouseClick::mouse_event(0x00000004, 0, 0, 0, 0);
}
Upvotes: 1