Use below Dynamic Management View (DMV) queries to get all the dimension and attributes of your cube
SELECT
[CATALOG_NAME]
as [Database],
CUBE_NAME AS [Cube],
[DIMENSION_UNIQUE_NAME]
AS [Dimension],
HIERARCHY_DISPLAY_FOLDER
AS [FOLDER],
HIERARCHY_CAPTION
AS [DIMENSION ATTRIBUTE],
HIERARCHY_IS_VISIBLE
AS [VISIBLE]
FROM
$system.MDSchema_hierarchies
WHERE
CUBE_NAME ='My Cube Name' AND
HIERARCHY_ORIGIN=2
ORDER BY
[DIMENSION_UNIQUE_NAME]
Note: Replace 'My Cube Name' with your cube name