Scripting requirements for PowerShell

Your custom PowerShell scripts must use environment variables to pass any non-Boolean command line parameter.

Replace non-Boolean parameters in the Param() portion of the script with script variables of the same name. Define the script variable as part of the environment with an SNC_ prefix. So a string parameter such as this:


Becomes a script variable such as the following:

if(test-path env:\SNC_paramName) {
    $paramName = $env:SNC_paramName

For example, this parameter definition from the PSScript.ps1 script contains several string parameters that need to be redefined as script variables:

Param([string]$computer, [string]$script, [string]$user, [string]$password, [boolean]$useCred, [boolean]$isDiscovery, [boolean]$debug)

Defining the non-Boolean parameters as script variables would result in this type of script:

Param([boolean]$useCred, [boolean]$isDiscovery, [boolean]$debug)
# Copy the environment variables to the params
if(test-path env:\SNC_computer) {
if(test-path env:\SNC_script) {
if(test-path env:\SNC_user) {