I spend my working days residing in a PowerShell console. Over time, I’ve developed many PowerShell modules to assist me handle the chaos that’s my work life. One space that all the time calls for consideration is managing my duties and To-Dos. For a number of years I’ve been utilizing the MyTasks module. This module saved duties and supporting info in a set of XML recordsdata. The code within the module handled the XML recordsdata as databases. I used to be making an attempt to keep away from a dependency on a SQL Server Specific set up with the concept that could be overkill.
ManageEngine ADManager Plus – Obtain Free Trial
ln the meantime, I lastly acquired round to ending and publishing the MySQLite PowerShell module. This module has a set of PowerShell features designed to simplify working with SQLite database recordsdata. One of these database has a a lot smaller footprint than SQL Server Specific and would streamline my process administration.
PSWorkItem Database
All of this has led me to launch a brand new PowerShell module referred to as PSWorkitem. This module takes the MySQLite module as a dependency and can solely run on PowerShell 7 on 64bit Home windows platforms. You may set up the module from the PowerShell Gallery.
Set up-Module PSWorkItem -force
The set up course of can even embrace the MySQLite module. Every part is saved in a single SQLite database file which you’ll be able to create utilizing Initialize-PSWorkItemDatabase.
Initialize=PSWWorkItemDatabase
The database shall be created at $HomePSWorkItem.db
. This path is saved to a worldwide variable PSWorkItemPath
, which is outlined whenever you import the module. All the module instructions which have a path to reference the PSWorkItem database use this world variable because the default worth.
To create a brand new PSWorkItem, specify the title, a class, and a due date. You may both specify the date and time or various days. The default is 30 days from now.
New-PSWorkItem -name "SRV2 backup" -category SRV
New-PSWorkItem "replace resume" Private -DaysDue 15
New-PSWorkItem "New AD Consumer script" Work -DueDate 8/15/2022 5:00PM
Classes
All duties, or PSWorkItems as I name them, have an related class. The module will create default classes of Work, Private, and Different. Classes are saved in their very own desk within the database file. You may add your classes.
Add-PSWorkItemCategory -Identify SRV -Description "server administration duties"
The module has a number of instructions for managing classes. Use Get-PSWorkItemCategory to view them.
PSWorkItems
All the object sorts within the module are based mostly on class definitions. The module instructions get information from the SQLite database and creates the suitable object. The PSWorkItem
kind has an outlined set of formatted views.
Get-PSWorkItem
The default is to show gadgets which are due inside 10 days, however you may have choices.
By default, duties due throughout the subsequent day or overdue shall be displayed in crimson. Duties due inside three days shall be displayed in yellow. The formatting is utilizing $PSStyle values, so that you would possibly get completely different outcomes relying in your console or terminal colour theme.
As well as, the module will create a worldwide variable referred to as PSWorkItemCategory
. It is a hashtable the place the bottom line is an outlined class, and the worth is a PSStyle or ANSI escape sequence.
$world:PSWorkItemCategory = @{
"Work" = $PSStyle.Foreground.Cyan
"Private" = $PSStyle.Foreground.Inexperienced
}
You may simply add your customized entries.
$PSWorkItemCategory.Add("Occasion","`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.