PowerWF News, Tutorials, and more...

Get the latest tips and tricks directly from the PowerWF development team. Find out about new releases and upcoming features.


Seamless Automation

From the Desktop to the Data Center

The PowerWF family of products are easy enough for desktop and departmental automation, yet powerful and scalable enough for the Data Center. PowerWF compliments Opalis and other RBA solutions, lets you leverage your workforce and preserves your investment as your automation needs grow.


Special - 20% Discount


In conjunction with our recently announced Silver Award from Windows IT Magazine we would like to offer our customers an opportunity to save 20% off any Devfarm product purchase through the end of the year. This includes all PowerWF products as well as Devfarm's new PowerVI product!

PowerVI

vSphere Automation fueled by PowerShell


Designed for the VMware Administrator, PowerVI eases the automation of vSphere infrastructures. PowerVI includes over 100 PowerShell automation scripts that simplify everyday VMware administration tasks and PowerVI makes it easy to author new scripts.
February 6, 2012

Multiplying Strings in PowerShell

One feature of PowerShell has always baffled me; why would anyone ever want to multiply a string?  Of course Scripting Guy Ed Wilson had a use case for it.

One of the really cool things that I use the string multiplication trick to do is to create an underline that is exactly the same length as the string it highlights. To do this, I use the Length property of the string and supply that to the multiplication operator along with the desired line separator to use. In the code that follows, I assign a string to the variable $a. Next, I use the Length property, which is a property that always exists on System.String objects, to determine the length of the string. I use the length of the string to determine how many times I want to multiply the underscore character (“_”). Next I display the string, and finally, I display the newly created underline. The code is shown here.

(read more and view code)



blog comments powered by Disqus