Skip to content

Instantly share code, notes, and snippets.

@asvignesh
Created August 27, 2015 14:27
Show Gist options
  • Save asvignesh/639005d8c4a699527c70 to your computer and use it in GitHub Desktop.
Save asvignesh/639005d8c4a699527c70 to your computer and use it in GitHub Desktop.
PowerShell Module
using System;
using System.Management.Automation;
namespace SamplePsModule
{
[Cmdlet(VerbsCommon.Get, "Vignesh")]
public class SampleGet : Cmdlet //Must inherit Cmdlet
{
//Parameters
[Parameter(Mandatory = true)]
public String name { get; set; }
[Parameter(Mandatory = true)]
public String id { get; set; }
[Parameter(Mandatory = true)]
public String category { get; set; }
//Begin Processing
protected override void BeginProcessing()
{
Data data = new Data();
data.name = name;
data.id = id;
data.category = category;
WriteObject(data);
}
}
public class Data
{
public String name { get; set; }
public String id { get; set; }
public String category { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment