I regularly have to convert an existing C# code snippet/.CS file to a PowerShell script. How could I automate this process?
While I am aware that there are methods that can convert a .cs file to a cmdlet, I’m only interested in converting the C# code to a script or module.
I know you’re looking for something that somehow converts C# directly to PowerShell, but I thought this is close enough to suggest it.
In PS v1 you can use a compiled .NET DLL:
In PS v2 you can add C# code directly into PowerShell and use it without ‘converting’ using Add-Type (copied straight from MSDN )