Skip to main content
2 broken links fixed
Source Link
Glorfindel
  • 2.2k
  • 5
  • 18
  • 26

You can do it using powershell.

$serverName = "servername\instanceName" 
$outputFolder = "D:\data\"

## load the AMO and XML assemblies into the current runspace 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") > $null 
[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") > $null 
$dateStamp = (get-Date).ToString("yyyyMMdd")

## connect to the server 
$svr = new-Object Microsoft.AnalysisServices.Server 
$svr.Connect($serverName) 
foreach ($db in $svr.Databases) 
{ 
    write-Host "Scripting: " $db.Name 
    $xw = new-object System.Xml.XmlTextWriter("$($outputFolder)DBScript_$($db.Name)_$($dateStamp).xmla", [System.Text.Encoding]::UTF8) 
    $xw.Formatting = [System.Xml.Formatting]::Indented 
    [Microsoft.AnalysisServices.Scripter]::WriteCreate($xw,$svr,$db,$true,$true) 
    $xw.Close() 
} 
$svr.Disconnect()

References :

You can do it using powershell.

$serverName = "servername\instanceName" 
$outputFolder = "D:\data\"

## load the AMO and XML assemblies into the current runspace 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") > $null 
[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") > $null 
$dateStamp = (get-Date).ToString("yyyyMMdd")

## connect to the server 
$svr = new-Object Microsoft.AnalysisServices.Server 
$svr.Connect($serverName) 
foreach ($db in $svr.Databases) 
{ 
    write-Host "Scripting: " $db.Name 
    $xw = new-object System.Xml.XmlTextWriter("$($outputFolder)DBScript_$($db.Name)_$($dateStamp).xmla", [System.Text.Encoding]::UTF8) 
    $xw.Formatting = [System.Xml.Formatting]::Indented 
    [Microsoft.AnalysisServices.Scripter]::WriteCreate($xw,$svr,$db,$true,$true) 
    $xw.Close() 
} 
$svr.Disconnect()

References :

You can do it using powershell.

$serverName = "servername\instanceName" 
$outputFolder = "D:\data\"

## load the AMO and XML assemblies into the current runspace 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") > $null 
[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") > $null 
$dateStamp = (get-Date).ToString("yyyyMMdd")

## connect to the server 
$svr = new-Object Microsoft.AnalysisServices.Server 
$svr.Connect($serverName) 
foreach ($db in $svr.Databases) 
{ 
    write-Host "Scripting: " $db.Name 
    $xw = new-object System.Xml.XmlTextWriter("$($outputFolder)DBScript_$($db.Name)_$($dateStamp).xmla", [System.Text.Encoding]::UTF8) 
    $xw.Formatting = [System.Xml.Formatting]::Indented 
    [Microsoft.AnalysisServices.Scripter]::WriteCreate($xw,$svr,$db,$true,$true) 
    $xw.Close() 
} 
$svr.Disconnect()

References :

Source Link
Kin Shah
  • 62.4k
  • 6
  • 122
  • 240

You can do it using powershell.

$serverName = "servername\instanceName" 
$outputFolder = "D:\data\"

## load the AMO and XML assemblies into the current runspace 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") > $null 
[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") > $null 
$dateStamp = (get-Date).ToString("yyyyMMdd")

## connect to the server 
$svr = new-Object Microsoft.AnalysisServices.Server 
$svr.Connect($serverName) 
foreach ($db in $svr.Databases) 
{ 
    write-Host "Scripting: " $db.Name 
    $xw = new-object System.Xml.XmlTextWriter("$($outputFolder)DBScript_$($db.Name)_$($dateStamp).xmla", [System.Text.Encoding]::UTF8) 
    $xw.Formatting = [System.Xml.Formatting]::Indented 
    [Microsoft.AnalysisServices.Scripter]::WriteCreate($xw,$svr,$db,$true,$true) 
    $xw.Close() 
} 
$svr.Disconnect()

References :