Windows Vista Forums

Integrating Powershell and C# 2.0
  1. #1


    Mugunth Guest

    Integrating Powershell and C# 2.0

    Hi,
    I wrote a simple mock application that'll make some automated calls to
    com objects.


    using System.Management.Automation;

    namespace PWSApp
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }



    private void Form1_Load(object sender, EventArgs e)
    {
    RunspaceInvoke rsi = new RunspaceInvoke();
    rsi.Invoke("$WMP = new-object -ComObject WMPlayer.OCX");
    rsi.Invoke("$WMP.openPlayer(\"SongName.mp3\");");

    }
    }
    }

    My Question here is,

    What all should I ship with this executable (apart from .NET Framework
    2.0) so that I can ensure that this application works on all machines.
    Is there any specific dll that should be distributed so that PowerShell
    specific features will work? Or is this bundled with .NET Framework
    2.0?

    Regards,
    Mugunth


      My System SpecsSystem Spec

  2. #2


    dreeschkind Guest

    RE: Integrating Powershell and C# 2.0

    "Mugunth" wrote:

    > What all should I ship with this executable (apart from .NET Framework
    > 2.0) so that I can ensure that this application works on all machines.
    > Is there any specific dll that should be distributed so that PowerShell
    > specific features will work? Or is this bundled with .NET Framework
    > 2.0?


    AFAIK PoSh will be released as an optional Windows Update later this year.
    Once all your machines have been updated and .NET Framework 2.0 is installed,
    everything should be fine.

    Copying only the core PoSh assemblies (System.Management.Automation etc.)
    might work (I did not test it), but I doubt that this is recommended or
    supported.

    --
    greetings
    dreeschkind

      My System SpecsSystem Spec

  3. #3


    Andrew Webb Guest

    RE: Integrating Powershell and C# 2.0

    > What all should I ship with this executable (apart from .NET Framework
    > 2.0) so that I can ensure that this application works on all machines.
    > Is there any specific dll that should be distributed so that PowerShell
    > specific features will work? Or is this bundled with .NET Framework
    > 2.0?


    Let the PowerShell WU (windows update) install the necessary DLLs to the
    GAC. Consider using the System.Activator class to late-bind to the
    PowerShell types, and provide a nice error message to the user if PowerShell
    isn't installed.

    Andrew

      My System SpecsSystem Spec

Integrating Powershell and C# 2.0 problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
integrating wmi in asp Alessandro VB Script 0 29 Apr 2010
integrating VBS into macro ayeFayze VB Script 0 04 Jun 2008
Integrating SP1 into Vista DVD? Brian W Vista General 3 12 Dec 2007
LABS: Writing PowerShell cmdlets and integrating with MMC Marco Shaw PowerShell 0 21 Jun 2007
Integrating English Speech recognition? Pim Vista General 3 07 Mar 2007