Open
Conversation
added 4 commits
November 23, 2015 13:56
Get-OfficeMRU.ps1
Retrieves key value and date modified
jt-msft
requested changes
Nov 4, 2016
| $ErrorActionPreference = "SilentlyContinue" | ||
|
|
||
| ## The following code is from | ||
| ## Name: Get-RegistryKeyTimestamp |
Collaborator
There was a problem hiding this comment.
What license was this script released under? Attribution is great, but we need to make sure it's compatible as well.
Collaborator
There was a problem hiding this comment.
Setting this will keep any of your catch blocks from doing anything.
$Orrig_EAP = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
Write-Host "before try"
try
{
Write-Host "In try"
Write-Error "Bad stuff happened"
Write-Host "After error"
}
catch
{
Write-Host "In catch"
}
finally
{
Write-Host "In finally"
$ErrorActionPreference = $Orrig_EAP
}
Write-Host "after try"before try
In try
After error
In finally
after try
Collaborator
There was a problem hiding this comment.
$ErrorActionPreference affects non-terminating errors.
Try/Catch/Finally is for handling terminating exceptions.
|
|
||
| if ($Error) { | ||
| # Write the $Error to the $Errorlog | ||
| Write-Error "Get-RegistryKeyValData Error on $env:COMPUTERNAME" |
Collaborator
There was a problem hiding this comment.
You shouldn't need to explicitly add the target's computer name. Error handling in the main script already takes care of that.
| .SYNOPSIS | ||
| Get-RegistryKeyValData.ps1 retrieves the value of the provided key as | ||
| well as the last modified time of the key. | ||
|
|
Collaborator
There was a problem hiding this comment.
Add a .PARAMETER attribute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Create a generic script that will pull Value, Data and LastWriteTime from arbitrary keys supplied by the user, maybe it has its own configuration file with a list of keys provided.