I spend my working days living in a PowerShell console. Over the years, I've developed many PowerShell modules to help me manage the chaos that is my work life. One area that always demands attention is managing my tasks and To-Dos. For several years I have been using the MyTasks module. This module stored tasks and supporting information in a set of XML files. The code in the module treated the XML files as databases. I was trying to avoid a dependency on a SQL Server Express installation with the idea that would be overkill.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
ln the meantime, I finally got around to finishing and publishing the MySQLite PowerShell module. This module has a set of PowerShell functions designed to simplify working with SQLite database files. This type of database has a much smaller footprint than SQL Server Express and would streamline my task management.
PSWorkItem Database
All of this has led me to release a new PowerShell module called PSWorkitem. This module takes the MySQLite module as a dependency and will only run on PowerShell 7 on 64bit Windows platforms. You can install the module from the PowerShell Gallery.
Install-Module PSWorkItem -force
The installation process will also include the MySQLite module. Everything is stored in a single SQLite database file which you can create using Initialize-PSWorkItemDatabase.
Initialize=PSWWorkItemDatabase
The database will be created at $Home\PSWorkItem.db
. This path is saved to a global variable PSWorkItemPath
, which is defined when you import the module. All of the module commands that have a path to reference the PSWorkItem database use this global variable as the default value.
To create a new PSWorkItem, specify the name, a category, and a due date. You can either specify the date and time or a number of days. The default is 30 days from now.
New-PSWorkItem -name "SRV2 backup" -category SRV
New-PSWorkItem "update resume" Personal -DaysDue 15
New-PSWorkItem "New AD User script" Work -DueDate 8/15/2022 5:00PM
Categories
All tasks, or PSWorkItems as I call them, have an associated category. The module will create default categories of Work, Personal, and Other. Categories are stored in their own table in the database file. You can add your categories.
Add-PSWorkItemCategory -Name SRV -Description "server management tasks"
The module has several commands for managing categories. Use Get-PSWorkItemCategory to view them.
PSWorkItems
All of the object types in the module are based on class definitions. The module commands get data from the SQLite database and creates the appropriate object. The PSWorkItem
type has a defined set of formatted views.
Get-PSWorkItem
The default is to display items that are due within 10 days, but you have options.
By default, tasks due within the next day or overdue will be displayed in red. Tasks due within three days will be displayed in yellow. The formatting is using $PSStyle values, so you might get different results depending on your console or terminal color theme.
In addition, the module will create a global variable called PSWorkItemCategory
. This is a hashtable where the key is a defined category, and the value is a PSStyle or ANSI escape sequence.
$global:PSWorkItemCategory = @{
"Work" = $PSStyle.Foreground.Cyan
"Personal" = $PSStyle.Foreground.Green
}
You can easily add your custom entries.
$PSWorkItemCategory.Add("Event","`e[38;5;153m")
Modifying PSWorkItems
You can update or modify existing tasks by their ID.
When a task is complete, you can mark it as such.
Complete-PSWorkItem -id 8
You should be able to use the module commands to manage everything. But you can always fall back to a more hands-on approach using the commands in the MySQLite module.
Summary
I am already finding the new module to be much easier to use. I moved the database file to a shared folder in DropBox and created a symbolic link to $HOME on my desktop and laptop. This allows me to use the module commands on either system and keep everything synchronized. I hope you'll read the project's README to learn more and give this module a try. If nothing else, I'd like to think that the PSWorkItem module can serve as a template for future PowerShell modules built around a SQLite database. I have at least one other project in mind.
Due date is not adhering to the regional date settings.
Would please post this as an issue with an example so that I can track it? Please also include your culturue (Get-Culture).
Many thanks for your work, description and sharing