Login-PowerBI -Environment Public #Fill in the Variables $WorkspaceName = 'Test Workspace' #Enter the name of the Workspace to upload to $ReportName = @() #Remove all reports for entire folder - @(). #Otherwise list reports out - @('Report 1', 'Report 2', 'Report 3') $UploadPath = "C:\examplepath\" #Enter the folder path for the PBIX files to Upload, Make sure to end the path with \ as this is a folder path $Conflict = 'CreateOrOverwrite' #Ignore - will give the workspace 2 reports with the same name #Abort - will error and leave current report uploaded #Overwrite - will only upload report if it already exists and overwrites it #CreateOrOverwrite - will upload report and overwrite if it does exist $Workspace = Get-PowerBIWorkspace -Name $WorkspaceName $Count = $ReportName.Count if ($Count -eq 0) { $Reports = Get-ChildItem -Path $UploadPath foreach ($r in $Reports) { $UploadFile = $UploadPath + $r.name New-PowerBIReport -Workspace $Workspace -Path $UploadFile -ConflictAction $Conflict $TextOutput = "Uploading " + $r.name Write-Output $TextOutput } } else { foreach ($r in $ReportName) { $UploadFile = $UploadPath + $r + '.pbix' New-PowerBIReport -Workspace $Workspace -Path $UploadFile -ConflictAction $Conflict $TextOutput = $UploadPath + $r + '.pbix' Write-Output $TextOutput } }