Achieving Black Screen on Client during Screenshare while Allowing RDP Access to Host
In this article, we will discuss the steps required to cause a black screen on the client when they attempt to screenshare, while still allowing Remote Desktop Protocol (RDP) access to the host. This can be useful in situations where you want to prevent sensitive information from being viewed during screensharing sessions, while still allowing remote access to the machine.
Prerequisites
Before we begin, it is important to note that this technique requires administrative access to the host machine. Additionally, the host machine must be running a version of Windows that supports RDP.
Step 1: Create a Batch File to Launch RDP
The first step is to create a batch file that will launch the RDP client and connect to the host machine. This can be done by creating a new text file and adding the following code:
@echo off
mstsc /v:<hostname or IP address>
Replace <hostname or IP address> with the hostname or IP address of the machine you want to connect to. Save this file with a .bat extension, such as rdp.bat.
Step 2: Create a VBS Script to Launch the Batch File
Next, we will create a VBS script that will launch the batch file in a new window, and then immediately close it. This will cause the RDP client to launch in the background, while the original window appears to close. This can be done by creating a new text file and adding the following code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "rdp.bat", 1, False
Save this file with a .vbs extension, such as launch\_rdp.vbs.
Step 3: Create a Shortcut to Launch the VBS Script
Now, we will create a shortcut that will launch the VBS script. This can be done by right-clicking on the desktop and selecting "New" > "Shortcut". In the "Create Shortcut" dialog box, enter the following code:
wscript.exe "<path to launch\_rdp.vbs>"
Replace <path to launch\_rdp.vbs> with the path to the launch\_rdp.vbs file you created earlier. Click "Next", and then enter a name for the shortcut. Click "Finish" to create the shortcut.
Step 4: Modify the Shortcut to Run as Administrator
To ensure that the RDP client launches with administrative privileges, we need to modify the shortcut to run as administrator. Right-click on the shortcut and select "Properties". In the "Properties" dialog box, click the "Advanced" button. Check the "Run as administrator" checkbox, and then click "OK" to close the dialog box. Click "OK" again to close the "Properties" dialog box.
Step 5: Create a Scheduled Task to Launch the Shortcut
Finally, we will create a scheduled task that will launch the shortcut when the user logs in. This can be done by opening the Task Scheduler and creating a new basic task. In the "Create Basic Task" dialog box, enter a name for the task, such as "Launch RDP". Click "Next", and then select "When I log on" as the trigger. Click "Next", and then select "Start a program" as the action. Click "Next", and then enter the following code:
%windir%\System32\cmd.exe /c "<path to shortcut>"
Replace <path to shortcut> with the path to the shortcut you created earlier. Click "Next", and then review the settings. Click "Finish" to create the scheduled task.
Step 6: Configure the Host Machine to Prevent Screensharing
To prevent screensharing on the host machine, we can use a third-party tool such as "Blacken Screens" or "Share
Summary
- In this article, we discussed the steps required to cause a black screen on the client when they attempt to screenshare, while still allowing Remote Desktop Protocol (RDP) access to the host.
- We created a batch file that launches the RDP client and connects to the host machine, and then created a VBS script that launches the batch file in a new window and closes it immediately.
- We created a shortcut that launches the VBS script, and then modified the shortcut to run as administrator.
- Finally, we created a scheduled task that launches the shortcut when the user logs in, and configured the host machine to prevent screensharing.
References
- Blacken Screens:
- ShareScreenBackground:
- How to Run a Program as an Administrator in Windows 10:
- How to Create a Scheduled Task in Windows 10: