C# with PowerShell

This topic contains 6 replies, has 4 voices, and was last updated by Profile photo of Graham Beer Graham Beer 7 months, 1 week ago.

  • Author
    Posts
  • #38427
    Profile photo of Graham Beer
    Graham Beer
    Participant

    I'm looking to have a play with C# with PowerShell . I have no experience with C#, wondering of anyone could recommend a book that might be helpful.thanks !

  • #38428
    Profile photo of Richard Diphoorn
    Richard Diphoorn
    Participant

    Hi Graham, maybe Doug's book could be helpful to you:

    http://www.amazon.com/Windows-PowerShell-Developers-Douglas-Finke/dp/1449322700/

    And if you have a Pluralsight account, you can check out this course (it's on my to-do list 🙂 ):

    https://www.pluralsight.com/courses/powershell-cmdlet-development-csharp

  • #38429
    Profile photo of Graham Beer
    Graham Beer
    Participant

    Thanks Richard, funny you should mention that book, I purchased it from Amazon this morning !

  • #38430
    Profile photo of Warren Frame
    Warren Frame
    Participant

    Hi Graham!

    There are a few ways you could go about this. Richard mentioned the first: You could use C# to write PowerShell Cmdlets. You would certainly learn a bit about both PowerShell and C#, but that might be quite a steep task for your first dabble in C#.

    Another option would be to just learn the basics of C#. You could compile and use C# on the fly in PowerShell, use csc.exe to compile your C# code, or play around with VS Code or Visual Studio itself – the community edition is a great free resource to learn with, but I'm personally starting to lean towards VS Code.

    As for resources, I'll let someone more knowledgeable answer – personally, I looked for free resources and experimented.

    Good luck!

  • #38437
    Profile photo of Graham Beer
    Graham Beer
    Participant

    Thanks Warren that's a good post and a couple of useful links. How do you say C#, is it 'C plus'? Is there a huge differance between C# and F#? Seems like C# had similar syntax to powershell.

  • #38440
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    You can create classes using inline C# and compile them through Add-Type to give you a really quick way to get started

  • #38443
    Profile photo of Graham Beer
    Graham Beer
    Participant

    Excellent, thanks Richard.

You must be logged in to reply to this topic.