Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Get-PWUserByLastLogin
    • Sign In

    • State Suggested Answer
    • Replies 4 replies
    • Answers 1 answer
    • Subscribers 65 subscribers
    • Views 277 views
    • Users 0 members are here
    • powershell
    • Programming
    • ProjectWise

    Get-PWUserByLastLogin

    Adrian Abshere
    Offline Adrian Abshere 6 months ago

    Get-PWUserByLastLogin is returning a significant number of users (with the command Get-PWUserByLastLogin -DaysAgo 60)

    where the user LastLogin day is 1/1/1979 (the equivalent of a zero maybe?). Looking at the audit history of some of these turns up that the logged in within the last few weeks or days.

    Any idea what's going on with this?

    • Sign in to reply
    • Cancel
    Parents
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Apr 4 2023 12:21 PM

      Get-PWUserByLastLogin operates with a login window defined by DaysAgo. By default it shows you all user's who's last login was PRIOR to the -DaysAgo value, so everyone that has NOT logged in for the last 60 days in your case.

      You can reverse the window to show all users that have logged in Since the DaysAgo setting by using the -Since option. -DaysAgo 60 -Since will show all users that have logged in within the last 60 days.

      The LastLogin in date is determined by the audit trail entries for the user, I believe it does NOT consider entries in the secondary audit trail table. If you have a process that cleans up login entries in the audit trail, by deleting them or moving to a secondary table, then the LastLogin value is 0 and shows as 1/1/1979.

      If you are seeing something other than this there may be a bug.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Adrian Abshere
      0 Offline Adrian Abshere Tue, Apr 4 2023 3:32 PM in reply to Kevin van Haaren

      Good to know about the date issue for archived log entries. Not the case here, as we aren't archiving our old audit entrie. For whatever reason, however, updating from 23.0.5.0 to 23.1.1.0 seems to have resolved the issue; we still have a lot of entries for people who have apparently never logged in, but I've spot checked more than 30, and, unlike when I checked under 23.0.5.0, I can no longer find entries where people have clearly logged in, but have a zero LastLogin from Ger-PWUserByLastLogin

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    Reply
    • Adrian Abshere
      0 Offline Adrian Abshere Tue, Apr 4 2023 3:32 PM in reply to Kevin van Haaren

      Good to know about the date issue for archived log entries. Not the case here, as we aren't archiving our old audit entrie. For whatever reason, however, updating from 23.0.5.0 to 23.1.1.0 seems to have resolved the issue; we still have a lot of entries for people who have apparently never logged in, but I've spot checked more than 30, and, unlike when I checked under 23.0.5.0, I can no longer find entries where people have clearly logged in, but have a zero LastLogin from Ger-PWUserByLastLogin

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    Children
    • MWBSI
      0 MWBSI Tue, Apr 4 2023 3:43 PM in reply to Adrian Abshere

      So this is working for you now?  Glad to hear it!  Tricky cmdlet.  There are many different kinds of users and audit tables.  Yes, a user with the last login date of 1/1/1979 has no record of logging in recorded in any of the audit tables.  If you use the -verbose switch you'll get more information. 

      Would anybody mind if we renamed the cmdlet to Get-PWUsersByLastLogin?

      Thanks,

      Mark Weisman | Bentley Systems

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies