#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

How To: Add a New Folder to All Projects

I had a user request a script that would add a sub-folder (PDF) to each of their rich projects / work areas within a ProjectWise Datasource.

The following script will add a specified folder to all ProjectWise Rich Projects / Work Areas within the current ProjectWise Datasource.

Update the values for the NewFolderName, NewFolderDescription, Environment, and StorageArea to meet your needs.

# Specify New Folder Name.
$NewFolderName = 'PDF'
# Specify New Folder Description.
$NewFolderDescription = 'Contains PDF files'
# Specify Environment to be used.
$Environment = 'Complex'
# Specify storage area to be used.
$StorageArea = 'Storage_01'

# Get all Rich Projects / Work Areas
$PWRichProjects = Get-PWRichProjects -Verbose
# Loop thru all projects returned.
foreach ($PWRichProject in $PWRichProjects)
{
# Using splatting for readability.
$NewFolderInfo = @{
FolderPath = "$($PWRichProject.FullPath)\$NewFolderName"
Description = $NewFolderDescription
Environment = $Environment
<# You can also set the storage area to that of the
   parent rich project storage area. #>
#StorageArea = $PWRichProject.Storage
StorageArea = $StorageArea
}
New-PWFolder @NewFolderInfo -Verbose
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s