-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #31 enhancement #144
base: master
Are you sure you want to change the base?
Conversation
Get-OfficeMRU.ps1
Retrieves key value and date modified
$ErrorActionPreference = "SilentlyContinue" | ||
|
||
## The following code is from | ||
## Name: Get-RegistryKeyTimestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What license was this script released under? Attribution is great, but we need to make sure it's compatible as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a .PARAMETER attribute.
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.