HomeAboutAll Posts

How to paste test to a restricted VDI that blocks clipboard

By Denis Molodtsov
Published in PowerShell
January 16, 2025
1 min read
How to paste test to a restricted VDI that blocks clipboard

Typing Clipboard Text into a Protected VDI Using AutoHotkey V2

As an IT consultant working with many clients, I increasingly have to deal with restricted VDIs. It is very common for these VDIs to have the clipboard feature disabled. As a result, I have to enter long, complicated passwords repeatedly by hand. Even worse, sometimes I have to type long URLs and UNC paths that the clients email me.

Today, I configured the solution documented in this article.

Goal

Press Ctrl+Alt+V inside the VDI to type out the text you copied outside it.

Pasting from Clipboard to VDI

Prerequisites

You should be allowed to install software on your local machine (not inside the VDI).


1. Install AutoHotkey (Version 2)

  1. Go to: https://www.autohotkey.com/
  2. Download AutoHotkey v2.
  3. Install with default settings.

2. Create the Script

Create a new file TypeFromClipboard.ahk with the following contents:

ahk
1
2
3
4
5
6
7
8
^!v::{
if !ClipWait(2)
return
Send "{Ctrl up}{Alt up}{Shift up}"
Sleep 300
text := StrReplace(A_Clipboard, "`r`n", "`n")
SendEvent "{Raw}" text
}

3. Test the Script

  1. Double-click TypeFromClipboard.ahk
  2. You should now see a green H icon in the system tray (script is active)
  3. Try copying some text. Then press Ctrl+Alt+V in a text editor. The text should be typed out.

alt text
alt text


4. Use It

  1. Outside the VDI: Copy text (Ctrl+C)
  2. Inside the VDI: place the cursor where you want to type
  3. Press Ctrl+Alt+V
  4. The text will be typed out into the VDI

5. Start Automatically at Login

  1. Press Win+R

  2. Type: shell:startup

    alt text
    alt text

  3. Press Enter

  4. Put a shortcut to TypeFromClipboard.ahk into this folder

    alt text
    alt text

Conclusion

Now you can easily paste text into VDIs that block the clipboard functionality. Just copy text outside the VDI and use Ctrl+Alt+V to type it inside the VDI.


Tags

PowerShellAutoHotkey

Share

Previous Article
Most useful PowerShell modules for IT consultants
Denis Molodtsov

Denis Molodtsov

Microsoft 365 Architect

Related Posts

Most useful PowerShell modules for IT consultants
Most useful PowerShell modules for IT consultants
January 16, 2025
1 min

Quick Links

AboutAll Posts

Social Media