You could do it using mdx.dll.