Skip to content

Instantly share code, notes, and snippets.

@mwjcomputing
Created June 17, 2014 16:34
Show Gist options
  • Select an option

  • Save mwjcomputing/946afc678b45c0b7d6fa to your computer and use it in GitHub Desktop.

Select an option

Save mwjcomputing/946afc678b45c0b7d6fa to your computer and use it in GitHub Desktop.
Testing
[Cmdlet(VerbsCommon.Get, "MWJName")]
public class GetMwjName : PSCmdlet
{
private string _typedName;
[Parameter(
Mandatory = true,
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
Position = 0,
HelpMessage = "Name to say hello to."
)]
[Alias("Person", "FirstName")]
public string Name
{
get { return _typedName; }
set { _typedName = value; }
}
protected override void ProcessRecord()
{
WriteVerbose("Writing name");
string name = "Hello " + _typedName;
WriteObject(name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment