zoukankan      html  css  js  c++  java
  • 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"; }
    }
    }
    }



  • 相关阅读:
    stress-Linux系统压力测试工具使用及系统负载很高的几种场景测试
    execsnoop-短时进程追踪工具
    走迷宫--DFS
    马踏棋盘--dfs
    查询前缀出现的次数----字典树
    找两个质数和为偶数的两个数
    煤气灶---递归
    求合力
    hdu2089---不要62(数位DP)
    轻重匹配
  • 原文地址:https://www.cnblogs.com/Amaranthus/p/2251957.html
Copyright © 2011-2022 走看看