Problem scenario: You want to install IIS on Windows Server 2016 in an automated way. But you are prevented from using Install-WindowsFeature or Add-WindowsFeature commands for business related reasons.
Normally something like this would work:
Import-module servermanager; Add-WindowsFeature web-server, web-webserver -Verbose
What do you do?
Solution: Use PowerShell with the System.Windows.Forms.SendKeys feature.
servermanager
start-sleep 2
[System.Windows.Forms.SendKeys]::SendWait{%"M"}
[System.Windows.Forms.SendKeys]::SendWait{%"M"}
start-sleep 1
[System.Windows.Forms.SendKeys]::SendWait("{DOWN}")
[System.Windows.Forms.SendKeys]::SendWait({~})
[System.Windows.Forms.SendKeys]::SendWait({nnn})
start-sleep 1
[System.Windows.Forms.SendKeys]::SendWait({w})
[System.Windows.Forms.SendKeys]::SendWait{~~}
start-sleep 1
[System.Windows.Forms.SendKeys]::SendWait("%{n}")
[System.Windows.Forms.SendKeys]::SendWait("%{n}")
[System.Windows.Forms.SendKeys]::SendWait("%{n}")
[System.Windows.Forms.SendKeys]::SendWait("%{n}")
[System.Windows.Forms.SendKeys]::SendWait("%{i}")