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

    Powershell: I got something wrong.

    IT Discussion
    powershell
    4
    17
    1.9k
    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.
    • DashrenderD
      Dashrender
      last edited by Dashrender

      OK

      Get-ADUser -filter {PasswordNeverExpires -eq $false}
      

      and

      Get-ADUser -filter {PasswordNeverExpires -eq $false} -Properties PasswordLastSet,Name,Description
      

      do work. Though I'm guessing that the -Properties option is meant to limit the output to only those three things, which it does not do, but I could be wrong on the expectation.
      In either case, the output from both commands is the same.

      1 Reply Last reply Reply Quote 0
      • GreyG
        Grey @EddieJennings
        last edited by

        @eddiejennings said in Powershell: I got something wrong.:

        I think Dash is on the right trail. Try it without the PasswordNeverExpires parameter.

        That param is fine. The dates are what's generating the error as it's not able to figure out both lt and gt, I think?

        DashrenderD JaredBuschJ 2 Replies Last reply Reply Quote 0
        • DashrenderD
          Dashrender @Grey
          last edited by

          @grey said in Powershell: I got something wrong.:

          @eddiejennings said in Powershell: I got something wrong.:

          I think Dash is on the right trail. Try it without the PasswordNeverExpires parameter.

          That param is fine. The dates are what's generating the error as it's not able to figure out both lt and gt, I think?

          yeah, when I only put that one filter in place, it's failing for me, the rest work.

          1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch @Grey
            last edited by

            @grey Specify PasswordLastSet after the -and also otherwise it has no idea what you are trying to -lt.

            Get-ADUser -filter {PasswordNeverExpires -eq $false -and (PasswordLastSet -gt "8/16/2017" -and PasswordLastSet -lt "8/21/2017") -and enabled -eq $true} -Properties PasswordLastSet,Name,Description
            
            GreyG 1 Reply Last reply Reply Quote 2
            • DashrenderD
              Dashrender
              last edited by

              damn - JB beat me by a few seconds

              1 Reply Last reply Reply Quote 0
              • EddieJenningsE
                EddieJennings
                last edited by

                I should only respond to posts when I can give them due attention. I feel like a fool for missing that. 😕

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

                  I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?

                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @Dashrender
                    last edited by

                    @dashrender said in Powershell: I got something wrong.:

                    I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?

                    not how that works.

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

                      @jaredbusch said in Powershell: I got something wrong.:

                      @dashrender said in Powershell: I got something wrong.:

                      I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?

                      not how that works.

                      Yeah I just tried, and nope failed.

                      JaredBuschJ 1 Reply Last reply Reply Quote 0
                      • JaredBuschJ
                        JaredBusch @Dashrender
                        last edited by JaredBusch

                        @dashrender said in Powershell: I got something wrong.:

                        @jaredbusch said in Powershell: I got something wrong.:

                        @dashrender said in Powershell: I got something wrong.:

                        I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?

                        not how that works.

                        Yeah I just tried, and nope failed.

                        There is no -between functionality in powershell.

                        1 Reply Last reply Reply Quote 0
                        • GreyG
                          Grey @JaredBusch
                          last edited by

                          @jaredbusch said in Powershell: I got something wrong.:

                          @grey Specify PasswordLastSet after the -and also otherwise it has no idea what you are trying to -lt.

                          Get-ADUser -filter {PasswordNeverExpires -eq $false -and (PasswordLastSet -gt "8/16/2017" -and PasswordLastSet -lt "8/21/2017") -and enabled -eq $true} -Properties PasswordLastSet,Name,Description
                          

                          You win at the Internet today. I should have caught that.

                          JaredBuschJ 1 Reply Last reply Reply Quote 0
                          • JaredBuschJ
                            JaredBusch @Grey
                            last edited by

                            @grey said in Powershell: I got something wrong.:

                            @jaredbusch said in Powershell: I got something wrong.:

                            @grey Specify PasswordLastSet after the -and also otherwise it has no idea what you are trying to -lt.

                            Get-ADUser -filter {PasswordNeverExpires -eq $false -and (PasswordLastSet -gt "8/16/2017" -and PasswordLastSet -lt "8/21/2017") -and enabled -eq $true} -Properties PasswordLastSet,Name,Description
                            

                            You win at the Internet today. I should have caught that.

                            I did enough time in development. I know how it goes.

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