page 1 of 1
Comments: 14 | Views: 42691 | Downloads: 3727
This Visual Studio template adds a C#and/or VB.NET project template for building Windows PowerShell Cmdlets and item templates in both languages to build CmdLet derived and PSCmdLet derived Windows PowerShell Cmdlets.

The project templates are a Visual Studio class library, with references to the Windows PowerShell assemblies. They also include a PSSnapIn class, which you can customise and use to install your Windows PowerShell cmdlets.

The item templates included, create a PSCmdLet or CmdLet derived class, with the correct class attributes, a commented example of a parameter, and an empty ProcessRecord method.

If you want to build Windows PowerShell cmdlets, this template will get you started and save you time.

Note the templates are not signed.
Thank you for the great template there, David Aiken.
I am enjoying every bit of this template now. Smiley

Dr Herbie
Dr Herbie
Horses for courses
Thanks David.
Very useful Smiley

How about a 'walkthrough' tutorial, too?  I'm finding documentation on this subject is a little sparse and spread out.

Herbie

David,

I installed VS in a 'non standard' way - on my D:\ HDD. your vsi files wont install, leaving a message of:
Installation stopped because the directory for the ProjectType value did not exist.  The project type is invalid for your installation of Visual Studio.
Any ideas please?

I am new to PS and cannot create and execute ANY .ps1 files. I get an error like this:
PS C:\scripts\PS> . ls


    Directory: Microsoft.PowerShell.Core\FileSystem::C:\scripts\PS


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        08/06/2007     10:42            Help
-a---        08/06/2007     11:59   18127360 abexet1.xls
-a---        08/06/2007     15:22       1558 changeimagetype.ps1
-a---        08/06/2007     11:17    7208826 Copy of exet1.csv
-a---        08/06/2007     10:44         51 errors1.ps1
-a---        08/06/2007     10:44         91 errors2.ps1
-a---        08/06/2007     11:59    7205486 exet1.csv
-a---        08/06/2007     12:00          0 exet1errors.csv
-a---        04/06/2007     11:02      28562 ExetHome_Full.txt
-a---        29/05/2007     12:47        732 ExetPS.txt
-a---        04/06/2007     09:56       5572 ExetPS_Full.txt
-a---        04/06/2007     11:04          0 ExetShared_Full.txt
-a---        08/06/2007     09:25         59 myscript.PS1


PS C:\scripts\PS> changeimagetype
The term 'changeimagetype' is not recognized as a cmdlet, function, operable program, or script file. Verify the term a
nd try again.
At line:1 char:15
+ changeimagetype <<<<
PS C:\scripts\PS> . changeimagetype
The term 'changeimagetype' is not recognized as a cmdlet, function, operable program, or script file. Verify the term a
nd try again.
At line:1 char:2
+ .  <<<< changeimagetype
PS C:\scripts\PS> changeimagetype .
The term 'changeimagetype' is not recognized as a cmdlet, function, operable program, or script file. Verify the term a
nd try again.
At line:1 char:16
+ changeimagetype  <<<< .
PS C:\scripts\PS>

i can see so many uses for powershell but this is stopping me progressing.

thanks

The problem I'm having with this post is where it says, "This Visual Studio template" - which template? Where? What? Is there something to click on that I'm missing?
David,

I encountered this VSTI error when I tried to install the Powershell templates:

Installation stopped because the directory for the ProjectType value did not exist.  The project type is invalid for your installation of Visual Studio.

I don't see anything unusual in the .vscontent file either; just...

            <Attribute name="ProjectType" value="Visual C#"/>

Visual Studio is installed on D:. I have recently installed the 180 day trial edition of the Team Foundation suite; but, beyond that, there is nothing distinctive about the installation.

Jesse
Two items:

First, on a 64 bit XP box, the Wizard Framework dlls can get lost and not in the GAC after the SDK for vista is installed. The following link
http://www.codeplex.com/DocProject/Thread/View.aspx?ThreadId=9037 will walk someone through the solution.

Second, when starting up my first Powershell project, the designer for the PSSnapin.cs had the following complaint:

    The designer must create an instance of type 'System.Management.Automation.PSSnapIn' but it cannot because the type is declared as abstract.

Hope this is useful.
ZippyV
ZippyV
Fired Up
jsinnott wrote:
Second, when starting up my first Powershell project, the designer for the PSSnapin.cs had the following complaint:

    The designer must create an instance of type 'System.Management.Automation.PSSnapIn' but it cannot because the type is declared as abstract.

Hope this is useful.


I got the exact same problem. Only installed the VB template. Using Vista x86, everything is up to date.
ZippyV
ZippyV
Fired Up
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

Thank you very much for this template. 

 

Does this template is compatible with Visual Studio 2008, if not is it possible to create Windows PowerShell Visual Studio 2008 Templates (VB.NET).

 

And more is it possible to have more examples on the use of classes.

page 1 of 1
Comments: 14 | Views: 42691 | Downloads: 3727
Microsoft Communities