Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Introducing PSProjectStatus

Posted on March 16, 2022March 16, 2022

I write a lot of PowerShell modules. And probably like you, I am working on more than one project at a time. I was finding it difficult to keep track of what I was working on and what I might be neglecting. So I turned to PowerShell and created a tool that I use to keep on top of my projects. The PowerShell module is called PSProjectStatus and you can install it from the PowerShell Gallery. You can find the project on GitHub, but I thought I'd provide an introduction here.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

Class-Based

The module is built around a PowerShell class that defines a PSProject object.

Class PSProject {
    [string]$Name = (Split-Path (Get-Location).path -Leaf)
    [string]$Path = (Convert-Path (Get-Location).path)
    [datetime]$LastUpdate = (Get-Date)
    [string[]]$Tasks
    [PSProjectStatus]$Status = "Development"
    [string]$GitBranch
    [string]$UpdateUser = "$([system.environment]::UserDomainName)\$([System.Environment]::Username)"

    [void]Save() {
        $json = Join-Path -Path $this.path -ChildPath psproject.json
        $this | Select-Object -Property * -exclude Age | ConvertTo-Json | Out-File $json
    }
}

The data to create the class is stored in a JSON file, psproject.json, which is stored in the module's root directory. The PSProjectStatus module has commands to manage this object and the JSON file.

Creating a Status

To create a new status, change to the root of your module and run New-PSProjectStatus.

Creating a psproject status

The Status property is based on an enumeration.

enum PSProjectStatus {
    Development
    Updating
    Stable
    AlphaTesting
    BetaTesting
    ReleaseCandidate
    Patching
    UnitTesting
    AcceptanceTesting
    Other
}

The default is Development. I've tried to add enough values to accommodate almost any situation. When you create a new PSProject status, information is written to a JSON file.

PSProjectStatus JSON

If a git branch is detected, it will be included.

Updating a Status

To update a status, use the Set-PSProjectStatus command.

set a psproject status

You can specify comma-separated list of tasks. I tend to keep them high-level and broad. If you want to add a task, use the -Concatentate parameter. Currently, there's no way to remove a task other than manually editing the JSON file. If you have your project open in VSCode, that's not too difficult to do. You can always manually edit the file. If you need to update the LastUpdate value, run Get-Date -format o | Set-Clipboard and paste the value into the file.

The Age property is a ScriptProperty added by extending the PSProject type.

Getting a Status

Normally, you will run Get-PSProjectStatus from the module root. The default output if a formatted table. This is the output you see when creating or setting a status. The module includes a list view.

psproject status as list

The list makes it easier to view tasks.

To manage everything on my plate, I can use this module in a PowerShell 7 script file.

#requires -version 7.2
#requires -module Microsoft.PowerShell.ConsoleGuiTools

#open a project using the PSProject status

Import-Module PSProjectStatus -Force

#get all projects
$all = Get-ChildItem -Path C:\Scripts -Directory | Get-PSProjectStatus -WarningAction SilentlyContinue

#display the projects in Out-ConsoleGridview and open the selected one in VS Code
$all | Sort-Object Status, LastUpdate |
Select-Object Path, Status, @{Name = "Tasks"; Expression = { $_.Tasks -join ',' } },
Gitbranch, LastUpdate |
Out-ConsoleGridView -Title "PSProject Management" -OutputMode Single |
ForEach-Object { code $_.path }

The script searches C:\Scripts for sub-folders with a psproject.json and displays the projects using Out-ConsoleGridview. From here, I can select a single module and open it in VS Code.

manage psproject

Try It

I hope you'll install the module and give it a spin. I'd like to know what you think and how it works for you. What would add value? I already have ideas for enhancements, but I'd live to hear what's on your mind. You are invited to use the repository's Discussions section.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

2 thoughts on “Introducing PSProjectStatus”

  1. Pingback: Introducing PSProjectStatus - The Lonely Administrator - Syndicated Blogs - IDERA Community
  2. Pingback: PSProjectStatus – Curated SQL

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d