Tag Archives: Scripting

PowerShell Scripting with [ValidatePattern]

I’ve been writing about a number of parameters attributes you can include in your PowerShell scripting to validate parameter values. Today I want to cover using a regular expression pattern to validate a parameter value. I’m going to assume you … Continue reading

Posted in PowerShell v2.0, Scripting | Tagged , , , | 3 Comments

PowerShell Scripting with [ValidateSet]

Today we’ll continue our exploration of the parameter validation attributes you can use in you PowerShell scripting. We’ve already looked at [ValidateRange] and [ValidateScript]. Another attribute you are likely to use is [ValidateSet()]. You can use this to verify that … Continue reading

Posted in PowerShell, PowerShell v2.0, Scripting | Tagged , , , | 6 Comments

PowerShell Scripting with [ValidateScript]

The last few days we’ve been looking at parameter validation attributes you might use in a script of function. Yesterday I wrote about [ValidateRange] and demonstrated how you might use it. That attribute works fine for any values that can … Continue reading

Posted in PowerShell, Scripting | Tagged , , , , | 2 Comments

PowerShell Scripting with [ValidateRange]

After my post yesterday on using the ValidateScript attribute with PSCredentials, I thought you might find it helpful to have a brief discussion on some other parameter validation attributes such as [ValidateRange()]. You can use this attribute if you want … Continue reading

Posted in PowerShell, Scripting | Tagged , , , | 9 Comments

Scripting with PSCredential

I see this question often: how can I pass a parameter value for a PSCredential that might be a credential object or it might be a user name? In the past I’ve used code like this: begin {     … Continue reading

Posted in PowerShell, security, WMI | Tagged , , , , , | 14 Comments