工具:VS 2010,.Net 3.5(特别提示.net 4不支持)

环境:PS V2,Windows 7

 

using System;
using System.Collections.Generic;
using System.Text;
using System.Management.Automation;
using System.Collections;
using System.Management;
using System.Collections.ObjectModel;

namespace Snapin
{
[Cmdlet(VerbsCommon.Get, "Hi")]
public class Snapin : PSCmdlet
{

protected override void ProcessRecord()
{
try
{
string str = "Hello Snapin";
WriteObject(str, false);
}
catch (Exception)
{
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Management.Automation;
namespace Snapin
{
[RunInstaller(true)]
public class SnapinPSSnapIn : PSSnapIn
{

public override string Name
{
get { return "SnapinHello"; }
}
public override string Vendor
{
get { return "Fanr"; }
}
public override string VendorResource
{
get { return "SnapinHello,Fanr"; }
}
public override string Description
{
get { return "Registers the CmdLets and Providers in this assembly"; }
}
public override string DescriptionResource
{
get { return "Snapin,Registers the CmdLets and Providers in this assembly"; }
}
}
}



相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-11-28
猜你喜欢
  • 2021-05-25
  • 2021-06-27
  • 2021-12-02
  • 2021-12-18
  • 2022-12-23
  • 2021-07-25
相关资源
相似解决方案