Powershell 开发Snapin简单入门

简介: 工具:VS 2010,.Net 3.5(特别提示.net 4不支持) 环境:PS V2,Windows 7   using System;using System.Collections.Generic;using System.

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



目录
相关文章
|
SQL Linux Windows
PowerShell 简介
经常使用PowerShell,却从未在博客中介绍过它 最近正好做了个PowerShell的技术分享,所以将内容共享出来,希望对初学者有所帮助   PowerShell历史   PowerShell印象 •PowerShell 是管理软件,拉近了Windows与Linux的距离 •PowerShell v2集成于Windows 7&2008 R2 •PowerShell基于.
814 0
|
Shell 开发者 Windows
PowerShell开发者的福音-脚本资源管理器
版权声明:本文为博主chszs的原创文章,未经博主允许不得转载。 https://blog.csdn.net/chszs/article/details/8094718 微软的脚本资源管理器是为PowerShell开发的,PowerShell只是一个脚本Shell环境,无法对脚本进行管理,所以微软开发了这个"脚本资源管理器",目的是帮助脚本开发者查找PowerShell脚本、脚本片段、模块,以及连接微软的在线技术中心,搜索本地或在线脚本库中的PowerShell脚本。
765 0
|
Linux iOS开发 MacOS

热门文章

最新文章