How Can I Automate Testing RDP Security Software?
Asked by
!PetalByPetal
I'm looking for a way to automate testing my RDP connections for security software. Each week, I manually try logging into several RDP sessions, usually by entering the wrong username and password to see if the software blocks my IP as expected. While I know I could check if a port is open with Test-NetConnection, I'm struggling to find a way to script these login attempts. Is there anyone who can guide me on how to do this? Thanks in advance!
Answers
You should check out my `invoke-mstsc` function on GitHub. It might be exactly what you need for scripting those RDP logins. You can find it at https://github.com/ztrhgf/LAPS.
Reply to this answer
I don't know much about a native PowerShell solution for this, but in my experience, I've used commands like `cmdkey /generic:"server-address" /user:"username" /pass:"password"` followed by `mstsc /v:server-address`, and then deleted the saved credentials. You'd need to check the output of the mstsc command to see if the connection failed. Just make sure the server supports saved logins!
Reply to this answer
If you're not using a VPN, it's worth considering an RDP proxy or a third-party gateway like NetScaler. Just opening the port publicly isn't the safest move. I haven't found a solid solution out there that works for this specific scenario. I did come across some PowerShell scripts that deal with creating credential objects, but if the server has credential caching disabled (which it should in a secure environment), those options won't be effective.
Reply to this answer
Yes, you can script using `mstsc.exe`. It's a straightforward option to automate your login tests.
Reply to this answer
Are you already getting swamped with failed login attempts with your current setup? I wouldn't be surprised if the exposes RDP service is attracting attention.
Reply to this answer
I thought there were multiple tools available for this kind of task in the hacking/Linux world, but I can't pinpoint a specific PowerShell solution. Aside from using `mstsc`, you might want to look into tools like RCMan, Royal TS, or mRemoteNG to save connections.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions