Get-Clipboard PowerShell V5

WMF 5 offers this cool cmdlet called Get-Clipboard. This cmdlet let you paste the content of the clipboard into a PowerShell variable and use it in your script. Lets do a simple demo

lets say you have a list of computer like so


Now lets right click on it and select copy or press crtl+C. Now these server name are in you clipboard. Open a PowerShell Window and type

“Get-Clipboard -Format Text”


The variable $a now has the list on the  server names and it can be used in a foreach loop to perform task on the servers. It is very helpful when testing logic of a script or need to get something done quickly.


There is another cool feature that Get-Clipboard offers when using the parameter -format. You can paste a file structure and PowerShell will return that folder structure  in a object if needed. Lets Take a look

Copy some folders from Windows Explorer


Now use the following cmdlet “Get-Clipboard -Format FileDropList” and it will give the folder structure as such


Also it will let you interact with the properties of the object




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s