ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Exchange Database and User Login Report Marriage

    Scheduled Pinned Locked Moved IT Discussion
    14 Posts 4 Posters 881 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dbeatoD
      dbeato @Texkonc
      last edited by

      @Texkonc So you basically want to know which users have not logged in on their Domain login for the last 90 days and match their mailbox and provide the usage of that said mailbox or mailboxes ?

      T 1 Reply Last reply Reply Quote 0
      • T
        Texkonc @dbeato
        last edited by

        @dbeato said in Exchange Database and User Login Report Marriage:

        @Texkonc So you basically want to know which users have not logged in on their Domain login for the last 90 days and match their mailbox and provide the usage of that said mailbox or mailboxes ?

        Bingo

        1 Reply Last reply Reply Quote 0
        • stacksofplatesS
          stacksofplates @Texkonc
          last edited by

          @Texkonc said in Exchange Database and User Login Report Marriage:

          How can I marry these two scripts?

          You need to be ordained and then have them exchange rings.

          T 1 Reply Last reply Reply Quote 0
          • T
            Texkonc @stacksofplates
            last edited by

            @stacksofplates said in Exchange Database and User Login Report Marriage:

            @Texkonc said in Exchange Database and User Login Report Marriage:

            How can I marry these two scripts?

            You need to be ordained and then have them exchange rings.

            Someone....had to go there...

            1 Reply Last reply Reply Quote 0
            • dbeatoD
              dbeato
              last edited by

              I will get you something tomorrow, dealing with something important this week.

              T 1 Reply Last reply Reply Quote 0
              • T
                Texkonc @dbeato
                last edited by

                @dbeato said in Exchange Database and User Login Report Marriage:

                I will get you something tomorrow, dealing with something important this week.

                If it works, Beer is on me!
                Second thought, I will let SAM pay.... 🙂

                dbeatoD 1 Reply Last reply Reply Quote 2
                • dbeatoD
                  dbeato @Texkonc
                  last edited by

                  @Texkonc said in Exchange Database and User Login Report Marriage:

                  @dbeato said in Exchange Database and User Login Report Marriage:

                  I will get you something tomorrow, dealing with something important this week.

                  If it works, Beer is on me!
                  Second thought, I will let SAM pay.... 🙂

                  Lol Ship it 😛

                  1 Reply Last reply Reply Quote 1
                  • dbeatoD
                    dbeato
                    last edited by

                    Now Back to the task, this was a mess whatever those two scripts you had did not take into account that this are not computers, this are users so the LastLogonDate is not a User Attribute and so forth. See below my script

                    #Import AD  and  Exchange Module (The Server Must have AD PowerShell Exchange PowerSHell  Modules)
                    Import-Module ActiveDirectory
                    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
                    #OU Iformation (if needed) ( I am not using it on my example)
                    $OU="dc=domain,dc=com"
                    #Get Today's Date
                    $today = Get-Date
                    #Date Format for File Name
                    $date = Get-Date -Format "MMddyyyy"
                    #Define a work folder for the report
                    $WorkFolder="C:\Scripts"
                    #Define the number of days to search for users that have not logged in
                    $Days=$today.AddDays(-90)
                    #Search for users
                    Get-ADUser -Filter {LastLogonDate -lt $Days -And Enabled -eq $TRUE }} | Select SAMAccountname | ConvertTo-Csv -NoTypeInformation | % { $_ -replace '"', ""}  | out-file "$WorkFolder\$date-Users.csv" -fo -en ascii
                    #Get all the Users from AD
                    $users= @(Get-Content $WorkFolder\$date-Users.csv)
                    #Loop for all the users to Report of All Mailboxes That are Inactive
                    foreach ($user in $users) {
                    Get-Mailbox -Identity $user | Select DisplayName,Database,WindowsEmailAddress,@{n="Size(MB)";e={[int]$(Get-MailboxStatistics $_.Alias).TotalItemSize.Value.ToMB()}} | Sort-Object "Size(MB)" -Descending | Export-Csv -Path $WorkFolder\MailboxStatistics-$date.csv -NoTypeInformation -Append
                    }
                    
                    

                    This will only give you the Reports of the Users That are Enabled and Have not logged in in the last 90 days. Now, give it a try and check it. If that is not what you are looking for then something else can be reviewed.

                    1 Reply Last reply Reply Quote 1
                    • T
                      Texkonc
                      last edited by

                      I ran it, but not a chance to review it yet. I should have time tomorrow.

                      1 Reply Last reply Reply Quote 0
                      • T
                        Texkonc
                        last edited by

                        OK, so Management wants these AD Attributes in the report.
                        In the List below
                        Attribute Management wants=What I think I need to call in the script

                        Name=Displayname
                        Company=Company
                        Description=Description
                        Department=Department
                        Title=Title
                        employeeID=Our only Custom Attribute.
                        Mail=EmailAddress
                        phyiscalDeliveryOfficeName=Office

                        Line 15, I added this string.
                        SAMaccountname,EmailAddress,GivenName,Surname,DisplayName,Description,Title,Department,Office,Company,employeeID

                        It made the Database file blank. I cant seem to see what it is that is making it barf.

                        dbeatoD 1 Reply Last reply Reply Quote 0
                        • DashrenderD
                          Dashrender
                          last edited by

                          Assuming linen 20 is what's outputting what you really care about, wouldn't you add your new items to it?
                          I'm guessing you don't care about that output at the userlist level, but instead at the finaly output level.

                          1 Reply Last reply Reply Quote 0
                          • dbeatoD
                            dbeato @Texkonc
                            last edited by

                            @Texkonc So you don't need the Mailbox status and all that? I just don't understand that requirement?

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              Texkonc @dbeato
                              last edited by

                              @dbeato said in Exchange Database and User Login Report Marriage:

                              @Texkonc So you don't need the Mailbox status and all that? I just don't understand that requirement?

                              Yes I do, but I also need these other attributes.

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post