' List information (Cubes, measure groups, dimensions and optionally partitions) in one SSAS database ' Example to run: ' CScript GetInfoOnOneDB.vbs /ServerName:IDS-DB4 /DBName:iw61bIdsDM /ShowPartitions:Yes Dim ServerName, DBName, ShowPartitions Set Arguments = WScript.Arguments.Named ServerName = Arguments.Item("ServerName") DBName = Arguments.Item("DBName") ShowPartitions = Arguments.Item("ShowPartitions") If LCase(ShowPartitions) <> "yes" Then ShowPartitions = "No" DIM StateOfObject StateOfObject = Array("Processed","PartiallyProcessed","Unprocessed") Dim oServer, oDB, oCube, oMG, oPart, oDim set oServer = CreateObject("Microsoft.AnalysisServices.Server") oServer.Connect(ServerName) FoundDB = False For Each oDB in oServer.Databases if LCase(oDB.Name) = LCase(DBName) Then FoundDB = True Exit For End If Next If FoundDB = False Then 'Database not found, terminate script WSCript.Echo "***ERROR. Server: " & ServerName & " SSAS Database: " & DBName & " NOT FOUND!!!" WScript.Quit(1) End If WScript.Echo "===== Database information" WScript.Echo "Name : " & oDB.Name WScript.Echo "State : " & StateOfObject(oDB.State) WScript.Echo "Last Update : " & CStr(oDB.LastUpdate) WScript.Echo "Last Processed : " & CStr(oDB.LastProcessed) WScript.Echo "Estimated Size : " & FormatNumber(CDbl(oDB.EstimatedSize) / 1024 / 1024) & " MB" ' On big DB could be slow, so consider commenting this line out WScript.Echo "" WSCript.Echo " Cubes in the database" For Each oCube in oDB.Cubes WScript.Echo "Cube: " & LEFT(oCube.Name & String(15," "), 15) & ", " & StateOfObject(oCube.State) & ", " & CStr(oCube.LastProcessed) For Each oMG in oCube.MeasureGroups WScript.Echo " MG: " & LEFT(oMG.Name & String(25," "), 25) & ", " & FormatNumber(CDbl(oMG.EstimatedSize) / 1024 / 1024) & " MB, " & StateOfObject(oMG.State) & ", " & CStr(oMG.LastProcessed) If LCase(ShowPartitions) = "yes" Then For Each oPart in oMG.Partitions WScript.Echo " Partition: " & LEFT(oPart.Name & String(25," "), 25) & ", " & FormatNumber(CDbl(oPart.EstimatedSize) / 1024 / 1024) & " MB, " & StateOfObject(oPart.State) & ", " & CStr(oPart.LastProcessed) Next ' oPart End If Next ' oMG WScript.Echo "" Next ' oCube WScript.Echo "" WScript.Echo "=== Dimensions" For Each oDim in oDB.Dimensions WScript.Echo "Dim: " & LEFT(oDim.Name & String(25," "), 25) & ", " & StateOfObject(oDim.State) & ", " & CStr(oDim.LastProcessed) Next WScript.Quit(0)