我正在尝试使用Powershell自动执行以下步骤。我能够执行Step1
我无法在Powershell中执行Step2。欢迎任何想法或建议。
答案 0 :(得分:1)
我使用以下代码进行了此操作:
步骤1的完成如以下网址中所述:https://gallery.technet.microsoft.com/scriptcenter/Connect-Mstsc-Open-RDP-2064b10b
第2步:完成以下代码。
[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);
}