Because we had to comply with a naming convention in a system not managed by yours truly, I had to manually set each uppercase FQDN server name to lowercase in a GUI. Beware, I litterally HATE manual tasks which should and could be automated somehow even if took more time to script, there is always the benefit where you could use the script again or at least gain some more coding experience. Since I had no control over the system to automate the task and didn’t want to convert the names in a editor which would make it even more tedious, I dediced to make a quick PowerShell one-liner. Just to have the illusion to be somewhat in control, so here it is.
Do {$Text=read-host “Text?”; [Windows.Forms.Clipboard]::SetText($Text.ToLower()) }Until (!$Text)
I’m using a ‘do’ loop ‘until’ the $Text variabel is empty(‘$null’). In this loop the ‘read-host’ cmdlet is used with the question “Text?” which expects user input at the prompt. That input is pasted to the clipboard (“[Windows.Forms.Clipboard]::SetText”) but not before the text has been set to lowercase characters (“.ToLower()”). If no input is given the $Text variabel will be set ‘$null’ and the loop ends.
In this way you can paste your text from the clipboard to the prompt and instantly have the text converted to lowercase, immediately pasted back in the clipboard. Then paste it to your GUI of choice and repeat that lighting fast, do some creative tabbing between windows and make manual labor fun again :-)