# Create a new InstallShield project $project = New-Object -ComObject ISWiAuto29.ISWiProject $projectFile = "C:\temp\test\Test.ism" $project.CreateProject($projectFile, 1) $project.OpenProject($projectFile) # Add files and folders $sourceFolder = "C:\Temp\test\Application" $destinationFolder = "INSTALLDIR" # Function to add files recursively function Add-Files($folder, $destination) { $files = Get-ChildItem -Path $folder -File foreach ($file in $files) { $project.AddFile($destination, $file.FullName) } $subfolders = Get-ChildItem -Path $folder -Directory foreach ($subfolder in $subfolders) { $newDestination = "$destination\\$($subfolder.Name)" $project.AddFolder($newDestination) Add-Files $subfolder.FullName $newDestination } } # Start adding files and folders Add-Files $sourceFolder $destinationFolder # Save and close the project $project.SaveProject() $project.CloseProject()