PrepAway - Latest Free Exam Questions & Answers

Get-ChildItem Cert:\\LocalMachine\\My |? { $_.NotAfter …

Note: This question is part of a series of questions that present the same scenario. Each question in
the series contains a unique solution that might meet the stated goals. Some question sets might have
more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these
questions will not appear in the review screen.
You have a server named Web1 that runs Windows Server 2016.
You need to list all the SSL certificates on Web1 that will expire during the next 60 days.
Solution: You run the following command.
Get-ChildItem Cert:\\LocalMachine\\My |? { $_.NotAfter –It (Get-Date).AddDays( 60 ) }
Does this meet the goal?

PrepAway - Latest Free Exam Questions & Answers

A.
Yes

B.
No

7 Comments on “Get-ChildItem Cert:\\LocalMachine\\My |? { $_.NotAfter …

  1. Nirav says:

    Get-ChildItem Cert:\\LocalMachine\\My |? { $_.NotAfter –It (Get-Date).AddDays( 60 ) } : This syntax cant have two revers slash \\.

    Get-ChildItem Cert:\LocalMachine\My |? {$_.NotAfter -lt (get-date).adddays(60)}




    0



    1
  2. davidcertifier says:

    The given answer is correct, although the exact command would be:
    Get-ChildItem Cert:\LocalMachine\My | ? { $_.NotAfter -lt (Get-Date).AddDays(60) }
    Or, following best practices:
    Get-ChildItem -Path ‘Cert:\LocalMachine\My’ | Where-Object -FilterScript { $PSItem.NotAfter -lt ((Get-Date).AddDays(60)) }

    This command looks at all the Local Computer’s Personal certificates and returns any that expire earlier than 60 days from the moment you run it, including certificates that have already expired.

    You can ignore the double slashes ‘\\’, the first is likely meant to be an escape character, which doesn’t appear to be needed. You’ll see it in every question that has slashes.




    10



    0

Leave a Reply