#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

HowTo:Use New .Methods

With this latest version of the PWPS_DAB module (version 1.21.0.0) we have incorporated methods into some of the ProjectWise objects; Users, Groups, UserLists, and Workflows. Using methods allows you to get additional information related to the particular object quickly without calling other cmdlets. We will look at each of the various objects.

ProjectWise Users

Lets take a look at the ProjectWise User object first. 

Get-Member

There are three new methods available with the ProjectWise User object. 

  • GetLastLogin
  • GroupsMemberOf
  • UserListsMemberOf

# Use Get-Member and only display the available methods.
Get-PWUsersByMatch | Get-Member | Where-Object MemberType -ieq 'method'

User-Get-Member-methods

Get Project User Object

Lets select a user to test with.

# Get User object
$pwUser = Get-PWUsersByMatch -UserName ‘brian.flaherty

user

 

Get Last Login Date / Time

The GetLastLogin will return the last date and time the selected ProjectWise User has logged in.

$pwUser.GetLastLogin()

You can see in the following image when the user last logged in.

lastlogin

List Group / UserList Membership

Now lets look at the membership methods.

The first will return a list containing all of the groups in which the user is a member of.

$pwUser.GroupsMemberOf()

groups

The second will return a list containing all of the user lists in which the user is a member of.

$pwUser.UserListsMemberOf()

userlists

 

ProjectWise Groups

The following shows the available methods for a ProjectWise Group Object.

groupmethods

Using the GetMembers method will return an array of User Objects.

The following shows the members of the group selected.

groupmembers

ProjectWise UserList

The following shows the available methods for a ProjectWise UserList Object.

userlistmethods

Using the GetMembers method will return an array of User / Group / UserList Objects.

The following shows the members of the userlist selected.

userlists

ProjectWise Workflows

The following shows the available methods for a ProjectWise Workflow Object.

workflowmethods

Using the GetStates method will return an array of ProjectWise State Objects which are associated with the specified workflow.

The following shows the States associated with the Workflow selected.

states


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.