troubleshooting Question

PowerShell script to format data in Clipboard

Avatar of Rich Rumble
Rich RumbleFlag for United States of America asked on
PowershellVB Script
6 Comments1 Solution209 ViewsLast Modified:
I'd like to have a PowerShell script that reads the contents of my clipboard, parses and formats the data, then re-writes the clipboard so I can paste it in formatted.
The entire process is, copy data to clipboard, press hot-key shortcut to the script (ctrl+alt+q for example), script re-writes the clipboard, then I paste clipboard to destination.

I have data like this:
---------------
INPUT:
IP Address: 10.10.10.10
Mac Adress: ab-cd-12-34-56-78-90
User Name: Grace Jones
Domain: Forrest-1
OU: Sales and Engineering
Department: Sales
Manager: Gus Fring
Location: ABQ
Computer Name: AsdfNiner5er
---------------
The output I'd like only certain fields, in a certain order, not all fields are present with each copy, sometimes Mac-Address: isn't there, or IP: isn't populated. Basically you can not assume that any one of the lines above will be present and or not populated. "IP: x.x.x.x" may be missing entirely, or "Mac-Address: " might not be populated after the colon. When they are not present, and or not populated, I don't want to see them in the output either.
Output:
    IP: 10.10.10.10
    Mac-Address: AB-CD-12-34-56-78-90
    User Name: Grace Jones
-----------
There are dozen's more input fields , and a few more the output, but that's the basic's. I figure "get-clipboard" and "set-clipboard" will do the trick nicely, I just have no idea about the parsing/formating.
Thanks!
-rich
ASKER CERTIFIED SOLUTION
Qlemo
"Batchelor", Developer and EE Topic Advisor
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros