< Back
New-MyDefaultsFile
Post
NAME New-MyDefaultsFile
SYNOPSIS
Creates a new default file for use by the MyDefault functions.
SYNTAX
New-MyDefaultsFile [<CommonParameters>]
DESCRIPTION
New-MyDefaultFile creates a new file in your $profile folder to hold default
values. These can then be used by functions when not overridden by specifying
them as parameters. This is done by using (Get-WPSDefault 'DefaultName') as
the parameter default value in a function definition. For example, if most of
the time you use function ABC you want parameter Name to be "thisuser", then
define the parameter in the function's code as:
$UserName = (Get-MyDefault 'UserName')
When you invoke the function, you can still provide UserName as a parameter,
but if you do not, it looks up the value for UserName in the MyDefaults.xml
file in your $Profile folder.
There are no parameters - the file is automatically named MyDefaults.xml and is
placed in the $Profile folder. This is required for the other functions to find
the file.
PARAMETERS
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
RELATED LINKS
SYNOPSIS
Creates a new default file for use by the MyDefault functions.
SYNTAX
New-MyDefaultsFile [<CommonParameters>]
DESCRIPTION
New-MyDefaultFile creates a new file in your $profile folder to hold default
values. These can then be used by functions when not overridden by specifying
them as parameters. This is done by using (Get-WPSDefault 'DefaultName') as
the parameter default value in a function definition. For example, if most of
the time you use function ABC you want parameter Name to be "thisuser", then
define the parameter in the function's code as:
$UserName = (Get-MyDefault 'UserName')
When you invoke the function, you can still provide UserName as a parameter,
but if you do not, it looks up the value for UserName in the MyDefaults.xml
file in your $Profile folder.
There are no parameters - the file is automatically named MyDefaults.xml and is
placed in the $Profile folder. This is required for the other functions to find
the file.
PARAMETERS
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
RELATED LINKS