Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
see changelog for 1.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Dec 13, 2018
1 parent 3d575be commit d5204fc
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 144 deletions.
2 changes: 1 addition & 1 deletion MyTasks.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RootModule = 'MyTasks.psm1'

# Version number of this module.
ModuleVersion = '1.8.0'
ModuleVersion = '1.8.2'

# ID used to uniquely identify this module
GUID = '6a5db6e0-9669-4178-a176-54b4931aa4e2'
Expand Down
16 changes: 10 additions & 6 deletions MyTasksFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1238,11 +1238,14 @@ Function Enable-EmailReminder {
[PSCredential]$MailCredential,
[Parameter(HelpMessage = "Send an HTML body email")]
[switch]$AsHtml,
[ValidateNotNullOrEmpty()]
[ValidateScript({$_ -gt 0})]
[int]$Days = 3,
[Parameter(Mandatory, HelpMessage = "Re-enter your local user credentials for the scheduled job task")]
[ValidateNotNullOrEmpty()]
[PSCredential]$TaskCredential,
[string]$TaskPath = $mytaskPath
[ValidateNotNullOrEmpty()]
[string]$TaskPath = $mytaskHome
)
Begin {
Write-Verbose "[$((Get-Date).TimeofDay) BEGIN ] Starting $($myinvocation.mycommand)"
Expand All @@ -1267,12 +1270,14 @@ Function Enable-EmailReminder {
$hash | Out-String | Write-Verbose
#define the job scriptblock
$sb = {
Param([hashtable]$Hash, [int]$Dayy, [string]$myPath)
#uncomment for troubleshooting
Param([hashtable]$Hash, [int]$Days, [string]$myPath)
#uncomment Write-Host lines for troubleshooting
#$PSBoundParameters | out-string | write-host -ForegroundColor cyan
#get tasks for the next 3 days as the body

Set-MyTaskPath -Path $myPath
#get-variable mytask* | out-string | Write-Host
write-host "[$((Get-Date).ToString())] Getting tasks for the next $days days."
$data = Get-MyTask -Days $Days
if ($data) {
if ($hash.BodyAsHTML) {
Expand Down Expand Up @@ -1322,18 +1327,17 @@ table { width:95%;margin-left:5px; margin-bottom:20px;}
}
}
else {
Write-Warning "No tasks found due in the next 3 days."
Write-Warning "No tasks found due in the next $days days."
#bail out
return
}
$hash.Add("Body", $body)
$hash.Add("Subject", "Tasks Due in the Next 3 Days")
$hash.Add("Subject", "Tasks Due in the Next $days Days")
$hash.Add("ErrorAction", "Stop")
Try {
Send-MailMessage @hash
#if you receive the job I wanted to display some sort of result
Write-Output "[$((Get-Date).ToString())] Message ($($hash.subject)) sent to $($hash.to) from $($hash.from)"
Write-Host "[$((Get-Date).ToString())] Message ($($hash.subject)) sent to $($hash.to) from $($hash.from)" -ForegroundColor green
}
Catch {
throw $_
Expand Down
1 change: 0 additions & 1 deletion Tests/MyTasks.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ InModuleScope MyTasks {

$Task.ID | Should -Be 2
$Task.Name | Should -Be "Test1"
$Task.DueDate.Year | Should -Be (Get-Date).Year
$Task.Category | Should -Be 'Testing'
$Task.DueDate | Should -Be $Due
$Task.Overdue | Should -Be $False
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log for MyTasks

## v1.8.2

+ Fixed bugs with email reminder. Typo in a parameter name.
+ Added parameter validation for `-Days` in `Enable-EmailReminder`
+ Help updates

## v1.8.0

+ Fixed Task Category bug (Issue #26) Thank you @shaneis
Expand Down
11 changes: 7 additions & 4 deletions docs/Enable-EmailReminder.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Enable-EmailReminder [[-Time] <DateTime>] [-SMTPServer <String>] -To <String> [-

## DESCRIPTION

This command will create a daily PowerShell scheduled job to send you an email with tasks that are due in the next 3 days. The default is a text message but you can send it as HTML which will include color coding for overdue tasks. This command requires the PSScheduledJob module.
This command will create a daily PowerShell scheduled job to send you an email with tasks that are due in the next 3 days. You can specify a different number of days. The default mail message is a text message but you can send it as HTML which will include color coding for overdue tasks. If you are using a custom path for your tasks, be sure you have run Set-MyTaskPath first and verified the settings before enabling an email reminder.

This command requires the PSScheduledJob module.

## EXAMPLES

Expand Down Expand Up @@ -94,7 +96,7 @@ Aliases:

Required: False
Position: Named
Default value: None
Default value: 25
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down Expand Up @@ -239,12 +241,13 @@ Aliases:

Required: False
Position: Named
Default value: None
Default value: $myTaskHome
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS
Expand All @@ -253,7 +256,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### None
### ScheduledJob

## NOTES

Expand Down
35 changes: 18 additions & 17 deletions docs/about_MyTasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ a glance you should be able to see project status and update your tasks.
## LONG DESCRIPTION

The core of this module is an object defined in a PowerShell class. The
class has a number of properties, some of which are hidden meaning you won't
class has a number of properties, some of which are hidden, meaning you won't
see them unless you specify the property name.

Note: ID and OverDue values are calculated at run time.
Expand All @@ -34,7 +34,7 @@ A MyTask object might look like this:
ID : 8
Name : Lab Setup
Description : DSC Labs
DueDate : 9/1/2017 12:00:00 AM
DueDate : 9/1/2018 12:00:00 AM
Overdue : False
Category : Work
Progress : 0
Expand Down Expand Up @@ -102,12 +102,12 @@ on comparing the current date to the DueDate. All tasks will be assigned an
ID value. Tasks are sorted by due date in descending order and completed
tasks are filtered out by default. This means that you might see gaps in the
IDs. Use the -All property to display everything or -Completed to see only
completed tasks.
completed tasks.

The module includes a custom format type extension file which includes
several custom views. You can try commands like these:

Get-Mytask | format-table -view Category
Get-Mytask | Sort-Object Category | format-table -view Category
Get-Mytask | format-list -view All

The second command is especially useful as it will display all properties,
Expand All @@ -133,11 +133,11 @@ these properties:
You can specify a task by its name or ID, although it might be easiest to
use `Get-MyTask` and pipe to `Set-MyTask`.

Get-MyTask -id 6 | Set-MyTask -Progress 33 -DueDate 8/20/2017 -Passthru
Get-MyTask -id 6 | Set-MyTask -Progress 33 -DueDate 8/20/2018 -Passthru

ID Name Description DueDate OverDue Category Progress
-- ---- ----------- ------- ------- -------- --------
6 Rebuild DC02 8/20/2017 False Work 33
6 Rebuild DC02 8/20/2018 False Work 33

### Completing a Task

Expand All @@ -163,7 +163,7 @@ folder using a timestamp filename.

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 7/19/2017 6:19 PM 16461 MyTasks_Backup_20170719.xml
-a---- 7/19/2018 6:19 PM 16461 MyTasks_Backup_20180719.xml

Or you can specify your own location and file name.

Expand Down Expand Up @@ -192,24 +192,25 @@ task XML file.

### Email Reminder

If you are running this module on a Windows platform with the PSScheduled jobs
module you can create a scheduled PowerShell job to send a daily email message
showing tasks that are due in the next 3 days. The default behavior is to send
a text message but you can send an HTML message which will add color coding to
highlight overdue and impending tasks.
If you are running this module on a Windows platform with the PSScheduled
jobs module you can create a scheduled PowerShell job to send a daily email
message showing tasks that are due in the next 3 days or whatever you choose.
The default behavior is to send a text message but you can send an HTML
message which will add color coding to highlight overdue and impending tasks.

Use `Enable-EmailReminder` to set up the scheduled job. The default time is
8:00AM daily but you can pick a different time. The job name is hard coded.
You will need to re-enter your current credentials for the task so that the
task scheduler has access to the network. Use `Disable-EmailReminder` to remove
task scheduler has access to the network. Run `Disable-EmailReminder` to remove
the task in case you want to change it. `Get-EmailReminder` will show you the
current state of the task.

## NOTE

This module is not intended as a full-feature project management tool. It is
intended to serve as a light-weight reminder or to-do list system. However,
feature requests and comments are welcome on the project's GitHub site.
feature requests and comments are welcome on the project's GitHub site at
https://github.com/jdhitsolutions/MyTasks.

## TROUBLESHOOTING NOTE

Expand All @@ -219,6 +220,6 @@ There are no known issues at this time.

## KEYWORDS

- task
- project
- to-do
+ task
+ project
+ to-do
13 changes: 7 additions & 6 deletions en-US/MyTasks-help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,8 @@ ID Name Description DueDate OverDue Category
</maml:description>
</command:details>
<maml:description>
<maml:para>This command will create a daily PowerShell scheduled job to send you an email with tasks that are due in the next 3 days. The default is a text message but you can send it as HTML which will include color coding for overdue tasks. This command requires the PSScheduledJob module.</maml:para>
<maml:para>This command will create a daily PowerShell scheduled job to send you an email with tasks that are due in the next 3 days. You can specify a different number of days. The default mail message is a text message but you can send it as HTML which will include color coding for overdue tasks. If you are using a custom path for your tasks, be sure you have run Set-MyTaskPath first and verified the settings before enabling an email reminder.</maml:para>
<maml:para>This command requires the PSScheduledJob module.</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
Expand Down Expand Up @@ -886,7 +887,7 @@ ID Name Description DueDate OverDue Category
<maml:name>Int32</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
<dev:defaultValue>25</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>SMTPServer</maml:name>
Expand Down Expand Up @@ -979,7 +980,7 @@ ID Name Description DueDate OverDue Category
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
<dev:defaultValue>$myTaskHome</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
Expand Down Expand Up @@ -1030,7 +1031,7 @@ ID Name Description DueDate OverDue Category
<maml:name>Int32</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
<dev:defaultValue>25</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>SMTPServer</maml:name>
Expand Down Expand Up @@ -1138,7 +1139,7 @@ ID Name Description DueDate OverDue Category
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
<dev:defaultValue>$myTaskHome</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
Expand All @@ -1154,7 +1155,7 @@ ID Name Description DueDate OverDue Category
<command:returnValues>
<command:returnValue>
<dev:type>
<maml:name>None</maml:name>
<maml:name>ScheduledJob</maml:name>
</dev:type>
<maml:description>
<maml:para></maml:para>
Expand Down
Loading

0 comments on commit d5204fc

Please sign in to comment.