LTI/ZTI PowerShell: Testing Script Parameters

Before running a parameterised script in your deployments, it’s important to test that the tab completion is working. To do this, open a PowerShell console and type the script name and a hyphen then press the {tab} key.

Tab Completion

Your script should return the available script parameters and function just like a regular PowerShell cmdlet. This test will prove that your script will pass parameters correctly when run in a task sequence.

You can find out more about script parameters by typing Get-Help About_Parameters in a PowerShell console. Below is a basic construct  for a parameterised script.

Param{
 $Name,
 $Value
}
Begin{}
Process{Write-Output "Values are $Name and $Value"}
End{}
Advertisements

About Andrew Barnes

A Scripting and Deployment Specialist.
This entry was posted in MDT 2010, MDT 2012, PowerShell, SCCM, Scripting and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s