Many times, when running PowerShell scripts which are processing a lot of documents and/or projects, having access control turned off for the ProjectWise user account will decrease the amount of time in which it takes for the task to complete. So, how can you do this within PowerShell?
With the release of PWPS_DAB module version 18.104.22.168, we have added the ability to get and set the “Use access control” user property. From within the user properties dialog, the “Use access control” property is located in the General section on the Settings tab as shown in the image below.
Take a look at the help for each of the cmdlets to become familiar with their functionality, available parameters, etc.
The Get-PWUserHasUseAccessControlOn cmdlet allows you to get the current setting for the “Use access control” user setting for the current user or one or more user accounts. The cmdlet has only one available parameter, -Users. You can pass an array of user objects to the cmdlet via the pipeline to get the corresponding setting value for each user.
You can also, not include any user objects and the setting for the current user will be returned as shown in the image below.
The Set-PWUserUseAccessControl allows you to turn on / off the “Use access control” user setting for the current user or one or more user objects. This cmdlet has two parameters available, -Users and -Turnoff. The -Users parameter accepts an array of user objects via the pipeline to update. The -Turnoff switch parameter, when included, will toggle off the “Use access control” option for the current user or the user object(s) passed via the pipeline.
When you make a change to the current user account, you will receive a warning message informing you that you will need to log out and log back in to ProjectWise in order for the change to take affect as shown in the image below.
The following demonstrates passing a few user objects via the pipeline to the Set-PWUserUseAccessControl cmdlet. Because the -Turnoff parameter was included, the “Use access control” user setting is turned off for all user objects passed.
In the following, we pass the same three user objects to the Set-PWUserUseAccessControl cmdlet, and because we did not include the -Turnoff parameter, the “Use access control” user setting is turned back on.
Experiment with it and have fun.
Hopefully, you find this useful. Please let me know if you have any questions or comments.