Forum Discussion
Request for Guidance on Programmatically Generating PBIP Folder Structure Using C# or PowerShell
- 1 year ago
Hi @bmidhun ,
we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,Chaithanya.
bmidhun
Here’s a full PowerShell script to generate this folder structure:
# Set the root folder where you want to create the PBIP structure
$rootPath = "C:\PBIPSample"
# Define all the folder paths
$folders = @(
"$rootPath\Report\.pbi",
"$rootPath\Report\StaticResources",
"$rootPath\SemanticModel\.pbi"
)
# Define the file paths
$files = @(
"$rootPath\Report\definition.pbir",
"$rootPath\Report\report.json",
"$rootPath\SemanticModel\definition"
)
# Create all folders
foreach ($folder in $folders) {
if (!(Test-Path -Path $folder)) {
New-Item -ItemType Directory -Path $folder -Force
}
}
# Create empty files
foreach ($file in $files) {
if (!(Test-Path -Path $file)) {
New-Item -ItemType File -Path $file -Force
}
}
Write-Host "PBIP structure created successfully at $rootPath!"
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!