# Connect using AMO thanks for stackexchange Smiley Happy
log_message "Connecting to PBI using AMO"
[System.Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.AnalysisServices.tabular.DLL")
("Microsoft.AnalysisServices") >$NULL
$server = New-Object Microsoft.AnalysisServices.tabular.Server
$server.connect($dataSource)
$database = $server.Databases.Item($Database_Name)
#Refreshing Bower BI (thanks to Marco russo http://www.sqlbi.com/articles/using-process-add-in-tabular-models/)
log_message "Trying to refresh Power BI now"
$model = $database.Model
$model.RequestRefresh("Full")
$model.SaveChanges()
$server.disconnect($dataSource)
This suite needs a command to refresh the table.
There is code to do this using AMO on Salvador's update script, which I have pasted below
There probable needs to be a
-Save
switch.