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 184.108.40.206. Take a look at the help for each of the cmdlets to become familiar with their functionality, available parameters, etc.
In the following code block we will be going through the following steps.
- Get results of the Get-PWUsersByMatch cmdlet.
- Pipe results to the Select-Object cmdlet to filter the data on the userid, name, description and email address.
- Pipe those results to the ConvertTo-CSV cmdlet.
- Finally, pipe the final results to the Out-File cmdlet.
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.
$OutputFile = 'd:\TEMP\ProjectWiseUsers.csv' Get-PWUsersByMatch | Select-Object UserID, Name, Description, Email | ConvertTo-Csv -NoTypeInformation | Out-File $OutputFile
The following shows an example of the output.
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.