I have been trying to build a package that can be called in an agent job to pass in paramaters for the purpose of backing up SSAS cubes. I have the code working but I can't seem to get the variables from SSIS to pass into the Powershell Script.
Here is the script with my latest attempt,
param($SSASServerName,$BackupLocation)$serverName=$SSASServerName$outputFolder=$BackupLocation## 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 ($dbin$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()
And in the Execute Process Task I try and bring them in the arguement field as C:\test\MDBackup.ps1 -$SSASServerName [User::SSASServerName] -$BackupLocation [User::BackupLocation]
What is the proper way to pass in SSIS variables to a powershell script running from an Execute Process Task?