• Powershell 开发Snapin简单入门


    工具: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"; }
    }
    }
    }



  • 相关阅读:
    idea安装
    IntelliJ IDEA 简单使用
    git客户端安装
    一、AJAX
    一、JSP标签介绍,自定义标签
    注解
    线程
    网络编程Socket
    一 批量插入数据(使用批处理
    day87
  • 原文地址:https://www.cnblogs.com/Amaranthus/p/2251957.html
Copyright © 2020-2023  润新知