Forum Discussion
PowerShell script example on how to run full refresh of incremental dataset?
- 5 years ago
Found out how to pull it off.
You create a .json file with this information:
{ "refresh": { "type": "full", "applyRefreshPolicy": false, "objects": [ { "database": "Your Dataset Name" } ] } }Then you create an Powershell script-file:
#Set Credentials $userName = "[email protected]" $password = ConvertTo-SecureString -String "YourPassword" -AsPlainText -Force $Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $userName, $password #Execute refresh $InputFileRefresh ="D:\MyJsonFile.json" invoke-ascmd -Server "powerbi://api.powerbi.com/v1.0/myorg/Your Workspace Name" -InputFile $InputFileRefresh -Credential $CredentialThat runs a full refresh of the dataset (but you won't see it running in the Power BI service and the Last Refresh Date in the PBI service will not be updated, just the data in the dataset).
Found out how to pull it off.
You create a .json file with this information:
{
"refresh": {
"type": "full",
"applyRefreshPolicy": false,
"objects": [
{
"database": "Your Dataset Name"
}
]
}
}Then you create an Powershell script-file:
#Set Credentials
$userName = "[email protected]"
$password = ConvertTo-SecureString -String "YourPassword" -AsPlainText -Force
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $userName, $password
#Execute refresh
$InputFileRefresh ="D:\MyJsonFile.json"
invoke-ascmd -Server "powerbi://api.powerbi.com/v1.0/myorg/Your Workspace Name" -InputFile $InputFileRefresh -Credential $CredentialThat runs a full refresh of the dataset (but you won't see it running in the Power BI service and the Last Refresh Date in the PBI service will not be updated, just the data in the dataset).
Hi Chris:
This sounds fine when refreshing a PowerBI dataset.
But do you know how to do the same for a PowerBI dataflow?
Even though, I've properly copied the script and changing the name of the dataflow instead of "Your dataset name", it doesn't work at all.
Do you have any idea?
- ChrisRenlund2 years agoAdvocate I
Hi, afm_bcn ,
Sorry, haven't tried it for a dataflow. But Dataflows doesn't show up as a database when you connect to a workspace with SQL Server management studio either, so I guess it's not the same type of workspace object.
I do know that we're able to refersh dataflows with API-calls, but don't have any with incremental refresh set up, so haven't looked into that.