#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

HowTo: Generate a Quick User Report

Have you ever had a request to provide a list of users within a ProjectWise datasource? Recently, I had a user ask for a report listing all users. They only wanted the User Name, Description and Email address. Simple enough, but I thought I’d share.

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 1.21.5.0. Take a look at the help for each of the cmdlets to become familiar with their functionality, available parameters, etc.

  • Get-PWUsersByMatch
  • ConvertTo-CSV
  • Out-File

Steps

In the following code block we will be going through the following steps.

  1. Get results of the Get-PWUsersByMatch cmdlet.
  2. Pipe results to the Select-Object cmdlet to filter the data on the userid, name, description and email address.
  3. Pipe those results to the ConvertTo-CSV cmdlet.
  4. Finally, pipe the final results to the Out-File cmdlet.

 Code

We are populating one variable with the path and name of the csv file to create and populate with the user data.

Include the -NoTypeInformation to keep your csv file clean.

The following shows the type information included in the csv file when not using the -NoTypeInformation switch parameter.

#TYPE Selected.Bentley.ProjectWise.PowerShell.Common.User

$OutputFile = 'd:\TEMP\ProjectWiseUsers.csv'
Get-PWUsersByMatch | Select-Object UserID, Name, Description, Email | 
ConvertTo-Csv -NoTypeInformation | Out-File $OutputFile

Output

The following shows an example of the output.

2020-06-17_9-42-38


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 )

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

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