PowerShell - Sendkeys remote

preview_player
Показать описание
In this video I demonstrate how and if you can use sendkeys remotely.
I got questioned a couple of times, if I could create a video on sending keys remotely.
The video content should create some understanding about the limitations of sendkeys as well.

*powershell sendkeys
*powershell sendkeys remote
*sendkeys remote
*remote sendkeys
*remote sendkey
*automation
*learn automation
*sendkeys
*sendkeys remote
*windows
*windows powershell
*automatic deployment
*automatic installations
*configuration as code

Code :

function clicker{
start-sleep -Seconds 10
try {
Start-Sleep -Milliseconds 5000
[Microsoft.VisualBasic.Interaction]::AppActivate("Document - Wordpad")
#[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("h")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("e")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("l")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("l")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("o")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("%{f}")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("{DOWN 3}")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("h")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("e")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("l")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("l")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("o")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("%{F4}")


}
catch {#ignore
}

}

#add-type -AssemblyName System.Windows.Forms
#add-type -AssemblyName microsoft.VisualBasic

[void] [System.Reflection.Assembly]::LoadWithPartialName("microsoft.VisualBasic")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

#start-process "notepad"

start-sleep -Seconds 5

clicker

code to set autologon and copy the script over.

New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoAdminLogon -Value 1
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultUserName -Value "home\$using:NewVmName"
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultPassword -Value MyPassword
}


New-SmbMapping -RemotePath "\\$IP\c$" -UserName $AdminCreds.UserName -Password $rootcred_salt

Рекомендации по теме
Комментарии
Автор

Question 1: Is it possible tu make a keylogger script with powershell ?
Question 2: How to hide a powershell script process from the windows task manager ?
Question 3: Is there a way for powershell to monitor and count print jobs on a local computer (number of printed documemts, number of pages per document)

kheurou
Автор

Hello Mr Automation, I have written a C# code to send keys to the remote desktop, an application running on my PC, I just want to send enter the command to any remote desktop that was active at that time

mehmoodayaztravel
Автор

Hi Mr. Automation. Thank for the video. I'm interested in sending keystrokes to Windows Logon Screen ( logonui.exe probably ) to perform automated user login. Is it possible? I'm aware that automated user logon can be achieved via registry and rebooting. My goal is automate user logon without reboot so I thought sending keystrokes can be a solution.

apechzzz
Автор

Thank you very much Sir.
My name is Cheikh, I'am from Senegal. i learned a lot from your Videos.
This sample code is interesting but i think that the code in the Hyper-v-Create ....ps1 file is more interesting.
As you didn't share it, i will try to look at the video and retype it myself.

kheurou