Announcement

Collapse
No announcement yet.

Get AD DS data

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get AD DS data

    I am new to powershell and I need a script that can tell me which computer accounts have been active within the 2 last month.

  • #2
    Re: Get AD DS data

    See if you can modify this to your requirements. http://www.randomtechtips.com/get-ac...ng-powershell/

    The only Powershell I know is how to spell it.
    1 1 was a racehorse.
    2 2 was 1 2.
    1 1 1 1 race 1 day,
    2 2 1 1 2

    Comment


    • #3
      Re: Get AD DS data

      I found this script http://anandthearchitect.com/2012/03...ive-directory/ and it does the trick.

      Now I need to get the Outlook versions from Exchange of all the users connecting to the Exchange server. I have found this script Get-MailboxServer | Get-LogonStatistics | Select UserName,ClientVersion,LastAccessTime,ServerName but it returns this as a version 3587.0.32963.1 and it is not correct. The Exchange server I am working with is 2010.

      Comment


      • #4
        Re: Get AD DS data

        You will want to run a log parser to get what you're after. The PS command you're running works when talking to Exchange 2007, but with 2010 the results changed to what you get now.

        Have a look at this page I found thru :

        http://msexchangeguru.com/2012/10/08...ient-versions/

        It lists your command, but you need to read the responses below, specifically #9. It's not PS but it looks like it'll get you what you need.
        *RicklesP*
        MSCA (2003/XP), Security+, CCNA

        ** Remember: credit where credit is due, and reputation points as appropriate **

        Comment


        • #5
          Re: Get AD DS data

          I understand this piece of code can do it
          Code:
          & “C:\Program Files (x86)\Log Parser 2.2\LogParser.exe” “SELECT client-software,client-software-version,client-mode,count(*) FROM ‘\\path\c$\Program Files\Microsoft\Exchange Server\V14\Logging\RPC Client Access\RCA_*.LOG’ group by client-software,client-software-version,client-mode” -
          nSkipLines:4 -i:CSV -rtp:-1
          But how do I execute it?

          Comment


          • #6
            Re: Get AD DS data

            i use powershell to do all kinds of crap. you can do so much with it... learn it. it will help you so much if you seriously do any real work in an AD environment. learn some LDAP and you should already be familiar with a command prompt, so just start using PS for everything and it will make things easier...

            i use a script like this to find the last user logon time. i have some outside VPN employees. they like to work via the VPN, but sometimes that all they do. they will logon the VPN and say 'ive been on since 8 AM!' but thing is, you never logged on to any service or RDP session anywhere... how do i know?

            Import-Module ActiveDirectory

            function Get-ADUserLastLogon([string]$userName)
            {
            $dcs = Get-ADDomainController -Filter {Name -like "*"}
            $time = 0
            foreach($dc in $dcs)
            {
            $hostname = $dc.HostName
            $user = Get-ADUser $userName | Get-ADObject -Server $hostname -Properties lastLogon
            if($user.LastLogon -gt $time)
            {
            $time = $user.LastLogon
            }
            }
            $dt = [DateTime]::FromFileTime($time)
            Write-Host $username "last logged on at:" $dt }

            Get-ADUserLastLogon -UserName USER_NAME_GOES_HERE
            have you at least got your powershell set up to execute? have you used it to do anything successfully yet? if not, just say so and i will point you towards something to get you started. powershell is such a powerful and useful tool. it will seriously help you and save you so much time...
            its easier to beg forgiveness than ask permission.
            Give karma where karma is due...

            Comment


            • #7
              Re: Get AD DS data

              Yes I have used powershell before, but this is out off my League. Is it possible to get the info of all AD users and Outlook client version?

              Comment


              • #8
                Re: Get AD DS data

                This is pretty easy if you have the Active Directory module.

                Search-ADAccount -Computers -AccountInactive -Timespan 60.00:00:00

                Originally posted by hilsoe View Post
                I am new to powershell and I need a script that can tell me which computer accounts have been active within the 2 last month.

                Comment


                • #9
                  Re: Get AD DS data

                  Originally posted by hilsoe View Post
                  I am new to powershell and I need a script that can tell me which computer accounts have been active within the 2 last month.
                  Does it have to be powershell?

                  Good old command prompt and oldcmp will do this for you.

                  Comment

                  Working...
                  X