Active Member
7 Posts
0 Kudos
Registered: ‎06-28-2011
Post 1 of 3

how to list all profiles on machine

165 Views, 2 Replies
06-08-2012 08:43 AM

I need to list all the profiles on a given machine and add a new profile if its not in the list. Is this possible in c#?  Can anyone point me in the right direction as i cant find anything conclusive when i searched

*Expert Elite*
9,836 Posts
1,219 Kudos
Registered: ‎06-29-2007
Post 2 of 3

Re: how to list all profiles on machine

06-08-2012 09:01 AM in reply to: ricobano



search in the registry, there you can find all AutoCAD versions installed plus all profiles in every from these installations (inlcuding vertical products based on AutoCAD).


The path to search is:


  • where xx.x is the release number
  • where yyyy:yyy stands for product + language



2012-06-08 17-56-57.png

- alfred -

Ingenieur Studio HOLLAUS ... www.hollaus.at
*Expert Elite*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 3 of 3

Re: how to list all profiles on machine

06-08-2012 02:15 PM in reply to: ricobano

Try to play around with this code

    Private Function GetAcadVer() As String
        Dim acadver As Object
            acadver = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\AutoCAD.Application\CurVer", _
                                                  String.Empty, String.Empty)
            If TypeOf acadver Is String Then
                Return acadver.ToString()
                Return Nothing
            End If
            Return Nothing
        End Try
    End Function

   Private Function GetAcadKind() As String

        Dim appver As Object
        Dim acadkind As Object
            appver = TryCast(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Autodesk\AutoCAD", "CurVer", Nothing), Object)
            If appver IsNot Nothing Then
                acadkind = TryCast(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Autodesk\AutoCAD" + "\" + appver, "CurVer", Nothing), Object)
                Return "HKEY_CURRENT_USER\Software\Autodesk\AutoCAD" + "\" + appver.ToString() + "\" + acadkind.ToString()
                Return Nothing
            End If
            Return Nothing
        End Try
    End Function

    Public Sub TestProfiles()
        Dim profiles As Object
        profiles = My.Computer.Registry.GetValue(GetAcadKind() + "\Profiles", _
        String.Empty, String.Empty)

        If TypeOf profiles Is String Then
            MessageBox.Show("String profiles: " & profiles.ToString())
        ElseIf TypeOf profiles Is Integer Then
            MessageBox.Show("Integer profiles: " & CInt(profiles))
        ElseIf TypeOf profiles Is String() Then
            MessageBox.Show("String array: ")
            Dim dataArray() As String = DirectCast(profiles, String())
            For ctr As Integer = LBound(dataArray, 1) To UBound(dataArray, 1)
                MessageBox.Show(" " & dataArray(ctr))
        ElseIf TypeOf profiles Is Byte() Then
            MessageBox.Show("Binary profiles: ")
            Dim byteArray() As Byte = DirectCast(profiles, Byte())
            For ctr As Integer = LBound(byteArray, 1) To UBound(byteArray, 1)
                MessageBox.Show(" " & Hex(byteArray(ctr)) & " ")
            MessageBox.Show("Unknown Profiles type...")
        End If
    End Sub



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!