powershell script to CLR RRS feed

  • Question

  • i have a powershell script that returns data in format-table format.

    Now I wanted to convert the powershell script to CLR and that CLR function I will be using it to SQL Server to return results.

    How to do the same ?




    Wednesday, April 3, 2019 8:35 PM


All replies

  • You will have to post questions on writing CLR code in whatever language you are referring to.

    For the record. PowerShell is already based on CLR. PowerShell can query SQLServer without any special considerations.

    help invoke-sqlcmd -full


    Wednesday, April 3, 2019 9:01 PM
  • Is there a way I can convert a .ps1 file to distribute as a CLR ?


    Wednesday, April 3, 2019 9:04 PM
  • Is there a way I can convert a .ps1 file to distribute as a CLR ?


    What is a CLR.  It seems you have heard about CLR but you do not know what it is.  Start by looking up CLR and learning what it is.

    Here is a good place to start:

    Once you understand this you will be able to ask a question that makes sense.


    Wednesday, April 3, 2019 9:08 PM
  • Yes you are right, I am not fully aware of CLR. I think my question do not make sense.

    The above link is an example of creating an C# class library project to convert as an CLR.

    Is there a way a .ps1 function can be converted to a clr function and thus can be called from T-sql is my original question.


    Wednesday, April 3, 2019 9:22 PM
  • You cannot create a C# class library from PowerShell script.


    • Marked as answer by Ganesh Babu Wednesday, April 3, 2019 10:47 PM
    Wednesday, April 3, 2019 9:57 PM