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).
It seems as it is part of the SqlServer module (https://docs.microsoft.com/en-us/powershell/module/sqlserver/invoke-ascmd?view=sqlserver-ps)
These are the modules I have on the server where the script is running (you can get yours with the Get-InstalledModule command):
| Version | Name | Repository | Description |
| 3000.10... | DataGateway | PSGallery | Data Gateway PowerShell cmdlets |
| 3000.10... | DataGateway.Profile | PSGallery | Data Gateway PowerShell - Profile credential management cmdlets for Data Gateway |
| 1.12 | Microsoft.ADAL.PowerShell | PSGallery | ADAL module for PowerShell |
| 21.1.18230 | SqlServer | PSGallery | This module allows SQL Server developers, administrators and business intelligence prof... |
Thank you.
It seems that I have the module, now I have an error message saying the cmdlet was found in the sqlserver package but could not be charged...
I'll find a way, thank you for your time.
Have a nice day. 😀
Clément