Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

PowerTip: Remove trailing space from a string by using PowerShell

Summary: Use the trim() method to remove leading and trailing spaces from a string. (image) Could you do me a huge favor and show me how to get rid of spaces before and after a string in PowerShell? (image) No problem at all. All you need to do is apply the trim() method to remove all the output. You can also use trimstart() to remove the ...

PowerTip: Set the color of the progress bar with PowerShell

Summary: Use the $Host object to alter the color of the progress bar in PowerShell. (image) I was curious if there’s a way to change the color of the progress bar in PowerShell. Do you know how this could be done? (image) Glad you asked! You can do this by altering the values for ProgressBackGroundColor and ProgressForegroundColor under $...