Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Powershell script to export out the username, email address and last login date to excel.
    • Sign In

    • State Verified Answer
    • Replies 2 replies
    • Subscribers 66 subscribers
    • Views 2017 views
    • Users 0 members are here
    • powershell
    • projectwise admin

    Powershell script to export out the username, email address and last login date to excel.

    RJ
    Offline RJ over 5 years ago

    I am looking for power shell script , to export out the username, email address  and last  login date to excel. Kindly help with some sample code\script. Thanks in advance. Regards,RJ

    • Sign in to reply
    • Cancel

    Top Replies

    • Phil Conard
      Offline Phil Conard Fri, Jun 22 2018 11:47 AM +1 verified
      Here is a simple one I use however I have seen better one for when you have multiple datasources to run this against. You will need to add the login switches to the script. It will vary depending on which…
    • Phil Conard
      +1 Offline Phil Conard Fri, Jun 22 2018 11:47 AM

      Here is a simple one I use however I have seen better one for when you have multiple datasources to run this against.  You will need to add the login switches to the script.  It will vary depending on which PS module you are using, PWPS or PWPS_DAB.

      $outfile = "C:\temp\datasource.csv"
      Get-PWMonthlyLogins -Month 1 -Year 2018| export-csv -Path $outfile -Append -NoTypeInformation
      Get-PWMonthlyLogins -Month 2 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation
      Get-PWMonthlyLogins -Month 3 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation



      Answer Verified By: RJ 

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • RJ
      0 Offline RJ Fri, Jun 22 2018 1:10 PM in reply to Phil Conard

      Thanks, Worked like a charm. Updated code if any one else from the community wants to use it,

      Import-Module pwps_dab

      $outfile = "C:\temp\datasource.csv"

      Open-PWConnection -admin -gui

      Get-PWMonthlyLogins -Month 1 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation

      Get-PWMonthlyLogins -Month 2 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation

      Get-PWMonthlyLogins -Month 3 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation

      Get-PWMonthlyLogins -Month 4 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation

      Get-PWMonthlyLogins -Month 5 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation

      Get-PWMonthlyLogins -Month 6 -Year 2018 | export-csv -Path $outfile -Append -NoTypeInformation

      Close-PWConnection

      • 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