Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: -- BATCH SCRIPT TO RDP CONNECT WITH USER+PASSWORD DETAILS FOR EASY RDP -- ::
- :: -- Install https://nmap.org/ -- ::
- :: -- Open cmd, and type: whoami
- :: -- output should look like this: desktop-XXXxxxX\user
- :: -- this is your RDP_USER -- ::
- @echo off
- setlocal enabledelayedexpansion
- set TARGET_MAC=00-C0-CA-00-00-00
- set RDP_USER=DESKTOP\username
- :: -- USERNAME ABOVE: desktop-XXXxxxX\user
- set RDP_PASS=password
- :: -- PASSWORD USED TO LOGIN TO THE RDP COMPUTER user your desktop-XXXxxxX\user
- REM find server IP from arp
- for /f "tokens=1,2" %%A in ('arp -a') do (
- if /I "%%B"=="%TARGET_MAC%" (
- set SERVER_IP=%%A
- )
- )
- if not defined SERVER_IP (
- echo Server not found in ARP table.
- pause
- exit /b
- )
- echo Server found at %SERVER_IP%
- echo Storing creds (cmdkey)...
- REM Save credential for this host (TERMSRV/<IP>)
- cmdkey /generic:TERMSRV/%SERVER_IP% /user:%RDP_USER% /pass:%RDP_PASS%
- echo Launching RDP...
- mstsc /v:%SERVER_IP% /admin
- REM Optionally delete stored credential after RDP closes:
- echo Removing stored credential...
- cmdkey /delete:TERMSRV/%SERVER_IP%
Advertisement