Featured

I documented Oh My Posh's DSC support and your terminal configuration just got way easier

Stop manually configuring your prompt. Start automating it and store it in version control

I documented Oh My Posh's DSC support and your terminal configuration just got way easier

I've been using Oh My Posh for nearly a year now. Custom themes. Tweaked a bunch of segments. Perfected my colors—everything exactly how I wanted it.

And then I got a new machine and started over again.

After doing this for PowerToys (where I documented Microsoft DSC support), I looked at Oh My Posh and thought: this needs the same treatment. All these configurations with all these settings. All are manually synchronized across my machines. There had to be a better approach.

So I wrote the documentation for Oh My Posh's DSC capabilities. And honestly? It changed how I think about my terminal configuration.

No more manual theme copying. No more editing profile files by hand. No more "wait, which settings did I use on my desktop?"

Just configuration as code. Define it once. Deploy it everywhere. Exactly how it should be.

If you're tired of manually configuring your prompt every time you touch a new machine, this is the solution you didn't know existed.

The real problem isn't configuration

Oh My Posh gives you incredible control. That's its strength. But it's also the source of the pain.

Look at what you can configure:

  • Themes and color schemes.
  • Individual segment behavior and styling.
  • Font choices and rendering.
  • Shell-specific initialization.
  • Transient prompt behavior
  • And dozens more settings buried in JSON files

For one machine? Manageable. For three machines? Tedious. For all your colleagues who think you've got the best terminal? A nightmare.

The manual approach kills your momentum. You spend time clicking through menus instead of actually using your beautifully configured terminal. And the worst part? Two months later, you can't remember exactly what you did.

I kept thinking: there has to be a better way.

What DSC actually does (and why you should care)

Desired State Configuration isn't new. Microsoft introduced it from PowerShell's early beginnings. But what Oh My Posh did recently changes the game for terminal configuration.

Here's what makes it powerful: you describe what you want, not how to get there.

Instead of: "Click here, then here, paste this, run that command, hope you didn't miss a step..."

You write: "This is my theme. This is my shell setup. This is what I want."

Then you tell Oh My Posh to make it happen. On any machine. Anytime. Consistently.

Three DSC resources handle everything:

  1. Config manages your theme files.
  2. Shell handles shell initialization.
  3. Font tracks your installed Nerd fonts.

The beauty? These resources work through simple CLI commands. No external dependencies. No complex frameworks. Just oh-my-posh with a few extra flags.

Your first automated PowerShell prompt

Let me show you what this looks like in practice. We'll focus on PowerShell since that's where most Windows developers live.

The DSC system tracks configurations you explicitly tell it to manage. If you're already using Oh My Posh (via oh-my-posh init pwsh --config <path>), DSC won't know about it until you register your configuration.

Here's how to capture your existing setup. First, check what DSC currently knows:

oh-my-posh config dsc get

If you get an empty result or just a schema, that's normal—DSC hasn't tracked anything yet.

To register your current theme, you need to tell DSC where your config file is. Let's start with a built-in theme:

$themePath = Join-Path $env:POSH_THEMES_PATH "jandedobbeleer.omp.json"
$config = @{
    states = @(
        @{
            source = $themePath
            format = "json"
        }
    )
}
$state = $config | ConvertTo-Json -Compress
oh-my-posh config dsc set --state $state

This uses the jandedobbeleer theme that ships with Oh My Posh. You can replace it with any built-in themelike atomic.omp.json, catppuccin.omp.json, or point to your own custom theme file at ~/.mytheme.omp.json.

Now, when you run oh-my-posh config dsc get, you'll see your full theme configuration:

{
  "states": [
    {
      "format": "json",
      "source": "C:\\Users\\<userName>\\AppData\\Local\\Programs\\oh-my-posh\\themes\\jandedobbeleer.omp.json",
      "upgrade": {
        "source": "cdn",
        "interval": "168h",
        "auto": false,
        "notice": false
      },
      "version": 3
    }
  ]
}

Simple, right? This is your configuration state, fully captured and exportable.

Now comes the magic part. Save that output to a file:

oh-my-posh config dsc get | Out-File my-prompt.json

On any new machine, apply your saved configuration:

oh-my-posh config dsc set --state (Get-Content my-prompt.json -Raw)

DSC reads the config, writes the theme file to the correct location, and tracks it for future updates.

The shell setup that actually works

But having a theme file isn't enough. Your PowerShell profile needs to initialize Oh My Posh. This is where most guides leave you hanging with "just add this line to your profile."

DSC handles this automatically.

Check your current shell configuration:

oh-my-posh shell dsc get

If Oh My Posh is already initialized, you'll see:

{"$schema":"https://ohmyposh.dev/dsc.shell.schema.json","states":[{"command":"oh-my-posh init pwsh","name":"pwsh"}]}

To set it up from scratch on a new machine using a different theme:

$themePath = Join-Path $env:POSH_THEMES_PATH "atomic.omp.json"
$shell = @{
    states = @(
        @{
            name = "pwsh"
            command = "oh-my-posh init pwsh --config $themePath"
        }
    )
}
$state = $shell | ConvertTo-Json -Compress
oh-my-posh shell dsc set --state $state
⚠️
DSC writes the configuration files, but doesn't reload your shell. Restart your terminal to see the changes take effect.

What just happened? Oh My Posh:

  1. Found your PowerShell profile file
  2. Added (or updated) the initialization command
  3. Configured the shell-specific syntax (Invoke-Expression for PowerShell)
  4. Left everything else in your profile untouched

No manual editing. No risk of breaking your profile. No copy-paste errors.

The complete configuration workflow

Here's how I set up a new machine now. Three commands. Two minutes.

Step 1: Install Oh My Posh

winget install JanDeDobbeleer.OhMyPosh

Step 2: Apply your theme

$config = @{
    states = @(
        @{
            source = "~/.config/omp/my-theme.omp.json"
            format = "json"
        }
    )
}
oh-my-posh config dsc set --state ($config | ConvertTo-Json -Compress)

Step 3: Initialize PowerShell

$shell = @{
    states = @(
        @{
            name = "pwsh"
            command = "oh-my-posh init pwsh --config ~/.config/omp/my-theme.omp.json"
        }
    )
}
oh-my-posh shell dsc set --state ($shell | ConvertTo-Json -Compress)

Step 4: Restart your terminal

The DSC commands write configuration files and update your profile, but don't reload the active shell. Close and reopen PowerShell to see your new prompt in action.

The difference isn't just time saved. It's the consistency that's guaranteed. You can save these commands to a PowerShell script or use WinGet as an orchestrator.

Before DSC, I'd hesitate to update Oh My Posh. What if the new version broke my carefully configured prompt? What if I couldn't reproduce my setup?

Now? Update fearlessly. Your configuration is captured. If something breaks, restore it in seconds:

oh-my-posh config dsc set --state (Get-Content backup.json -Raw)

Your next move

If you're still manually configuring Oh My Posh across machines, stop. You're working too hard.

Start with just PowerShell. Export your current config:

oh-my-posh config dsc get | Out-File ~/omp-config.json
oh-my-posh shell dsc get | Out-File ~/omp-shell.json

Store those files somewhere safe, whether it is GitHub, OneDrive, or Dropbox.

Next time you set up a new machine, use those files. Watch how fast it becomes. Feel the relief of knowing your configuration is captured, not lost in your memory.

Want to dive deeper? Check out the Oh My Posh DSC documentation for advanced configuration techniques, WinGet integration, and multi-shell setup.