I want to create an inventory of all the functions we have in our Scripts library

Hi,

We have a lot of Scripts in DialogScripts but inside these scripts there might be multiple functions that can be called.

Is there a way SQL/Vb.net/Powershell to retrieve all the methods and parameters?

I have access to the ScriptClass ( $scriptClass = $Session.Scripts.get_item("Scripts") With this I can call an existing script and get the parameters ( $Parameters = ($scriptClass.Item($ScriptName).GetParameters() )

But when I use this I need to know the name of the function.

How can I retrieve a list of all the (custom) functions within our OneIdentity Script library?

I hope you can help. Thanks!

  • Maybe this will help...

    Open solution project in Visual Studio: ...\SystemLibrary\SystemLibrary.sln
    Press F5
    Connect to OneIM
    From menu: Library > Recreate system library

    From VS toolbar: Analyse > Calculate Code Metrics > For solution
    In Code Metrics Results pane
    Right click on Scripts (Debug)
    Open the Selection in Microsoft Excel

    stackoverflow.com/.../get-list-of-functions-and-subs-in-a-class-file

  • Hi Niels,

    Thanks for the reply. That is indeed nice to get a nice overview.

    I was hoping do run some kind of command to get all the functions so I could automate it in case new funcions are created but this is already helping me out!

  • Hello Patrick,

    I gave it a try. For the class DynScripts.ProductScripts it list all the OOTB functions/subs
    but for the custom scripts class 'DynScripts.CustomerScripts' I get is not defined.

    Public Sub CCC_ListMethods()
     
    Dim methods As New List(Of String) 
    Dim myType As Type = GetType(DynScripts.ProductScripts)
    'Dim myType As Type = GetType(DynScripts.CustomerScripts)
    Dim myArrayMethodInfo As MethodInfo() = myType.GetMethods()
    Dim i As Integer
            For i = 0 To myArrayMethodInfo.Length - 1
                Dim myMethodInfo As MethodInfo = CType(myArrayMethodInfo(i), MethodInfo)
               methods.Add((ControlChars.Cr + "The name of the method is " & myMethodInfo.Name & "."))
    Next i
    Throw New Exception(String.Join(System.Environment.NewLine, methods))
    End Sub