Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! Can Windows PowerShell Functions Accept More Than One Input?

  Hey, Scripting Guy! I have a function that I would like to modify to accept multiple inputs. I have seen examples of a function that uses a single input parameter, but I have not found a Windows PowerShell function that uses two inputs. How can I cause the function to accept two inputs? More importantly, how can I call a function...

Hey, Scripting Guy! Why Would I Even Want to Use Functions in My Windows PowerShell Scripts?

  Hey, Scripting Guy! You have been talking about writing functions and using functions all week. To me it seems like a lot of extra work to create a function. Do I have to write functions? Or can I just write my code in a script like I used to do with VBScript?-- GB Hello GB, Microsoft Scripting Guy Ed Wilson here. The other ...

Hey, Scripting Guy! How Can I Use “Real Names” for Windows PowerShell Functions?

  Hey, Scripting Guy! I enjoyed reading yesterday’s blog post about working with functions. I was really interested when you were talking about using “real names” for my functions. You did not say too much about why I should do that, but I guess it makes sense. I am thinking about writing a function that reads a ...

Hey, Scripting Guy! How Do I Use Functions in Windows PowerShell 2.0?

  Hey, Scripting Guy! I am confused about using functions in Windows PowerShell 2.0. I was also confused about using functions in Windows PowerShell 1.0. Are they like functions in VBScript, or are they something different? In addition, I have tried to create a subroutine in Windows PowerShell, and it does not seem to work. What am...

Hey, Scripting Guy! Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (12/18/09)

In this post:  Help Me Make This Code Work!Hey, Scripting Guy! When I follow your examples on accessing SQL Server objects using Windows PowerShell, I do not seem to get the same results as you. An example is the Why Should I Use Windows PowerShell with SQL Server 2008 post that talks about using Windows PowerShell to...