#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

HowTo: Get Work Areas by Date Properties

Be sure to check out my Scripting4Crypto initiative. It’s a fun way to get into using cryptocurrencies all while getting your PowerShell needs met.

In this post, we will be returning all ProjectWise Work Areas where the Project Properties date values meet specified criteria. I had a user ask for a way to filter the Work Areas returned based on start and end dates similar to how you would in a saved search. Unfortunately, at this time PWPS_DAB does not support Work Area / Folder saved searches.

We will be using the following cmdlets to accomplish this task. All of the ProjectWise related cmdlets are available using the PWPS_DAB module. At the time of this post, I am using version Take a look at the help for each of the cmdlets to become familiar with their functionality, available parameters, etc.

  • Get-PWRichProjectProperties
  • Get-PWRichProjects

Work Area Date Properties

The following will return ALL available Work Area properties with ‘_Date’ in the name.

(Get-PWRichProjectProperties).GetEnumerator() | Where-Object { $_ -match '_Date' }



I am going to create three variables to use. The first one $ProjectTypeName will specify the Work Area type to search for. The second and third will be for the start and end dates respectively.

Notice the start date variable is populated with an empty string. This is one way you can test for a null value within a property.  The end date will be derived from today’s date minus 90 days. 

$ProjectTypeName = 'Building'
$StartDate = [string]::Empty
$EndDate = ([DateTime]::Today).AddDays(-90)

Get Work Areas

Now that we have our variables created and populated, we can get the Work Areas based on the information provided.

Here we will first use the Get-PWRichProjects cmdlet to return all of the Work Areas based on the value in the $ProjectTypeName variable.  We will then pipe those results to the Where-Object to filter on the start date. Note, the start date cannot be a null value. Next we will pipe those results to another Where-Object to filter on the end date which must be greater than the value in the $EndDate variable.

$pwWorkAreas = Get-PWRichProjects -ProjectTypeName $ProjectTypeName -PopulateProjectProperties |
Where-Object { $_.ProjectProperties.PROJECT_Start_Date -ne $StartDate } |
Where-Object { ([DateTime] $_.ProjectProperties.PROJECT_End_Date) -gt $EndDate }

You could also do this using a -And within the Where-Object as follows. Each method should return the same data within this example. However, there are times which using multiple Where-Objects is required. It may also be easier to follow

$pwWorkAreas = Get-PWRichProjects -ProjectTypeName $ProjectTypeName -PopulateProjectProperties |
Where-Object { $_.ProjectProperties.PROJECT_Start_Date -ne $StartDate -and ([DateTime] $_.ProjectProperties.PROJECT_End_Date) -gt $EndDate }

The following show the first Work Area in our results.


Experiment with it and have fun.

Hopefully, you find this useful. Please let me know if you have any questions or comments.  If you like this post, please click the Like button at the bottom of the page.

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.