https://www.sikich.com

Automatically recording your Microsoft 365 PowerShell sessions

INSIGHT 5 min read

When you spend much of your day working in Microsoft 365 PowerShell, it doesn’t take long before the commands blur together. Maybe you ran Get-MailboxPermission yesterday while auditing access, or you checked a mailbox size last week. But when you need to retrace your steps—or prove exactly what was done—guessing isn’t good enough. 

That’s where PowerShell’s Start-Transcript comes in. It’s one of the simplest tools available, but it has become one of the most valuable habits I’ve developed. Every time I start a PowerShell session, I log it. Everything I type and every output that comes back is all captured automatically in a transcript file I can reference later. 

It sounds small, but the payoff has been huge. 

Why transcripts are better than memory 

Early in my career, I thought I could rely on memory or scattered notes. I’d jot a few things here and there, keep a couple of scripts handy, and assume that would be enough. It wasn’t. 

  • Memory fails. After a week of working across multiple tenants or projects, the details get fuzzy. 
  • Troubleshooting demands precision. When an environment isn’t behaving as expected, “I think I ran X” doesn’t cut it. 

With transcripts, none of that is an issue. I can go back and see exactly what happened. 

Some of the key benefits: 

  • I can retrace my steps when troubleshooting. 
  • I have a reliable audit trail of changes I made to tenant settings. 
  • I can reuse working commands by copy-pasting them from past sessions. 
  • I can compare outputs over time, which is helpful for spotting gradual changes like mailbox growth. 

Real-world situations where transcripts shine 

A few examples from day-to-day work: 

  • Tracking Mailbox Permissions 
    When auditing mailbox access, I don’t just rely on a one-time query. I can look back at transcripts to see who had access last week, last month, or last quarter. 
  • Monitoring Changes Over Time 
    Sometimes I need to run the same command repeatedly—like checking mailbox sizes with Get-MailboxStatistics. By capturing the output in transcripts, I can review growth trends, spot anomalies, or plan migrations more effectively. 
  • Infrastructure or Security Projects 
    During administrative changes or conditional access rollouts, every configuration command matters. A transcript provides a step-by-step record, ensuring consistency and accountability. 
  • Script Development and Debugging 
    When building or tweaking a script, I rarely get it perfect on the first try. A transcript captures my trial-and-error process, which helps me understand what worked—and what didn’t—without rerunning every test. 
  • Documentation 
    Many internal how-to guides start as transcript snippets. Instead of reinventing the wheel, I can pull directly from past sessions. 

Setting it up: Simple but powerful 

Using transcripts is straightforward. At the beginning of a session, I run: 

Start-Transcript -Path "C:\scratch\Session_$((Get-Date).ToString('yyyyMMdd_HHmm')).txt" 

Note: I personally store my transcript files in C:\scratch for quick access and organization, but you can choose any folder that works for you. 

When I’m done, I just type: 

Stop-Transcript 

Or, if you close the PowerShell session, the transcript automatically stops safely. You don’t need to manually stop it unless you want to end it earlier. 

Making transcripts automatic via your profile 

If you want every session logged without thinking about it, you can add Start-Transcript to your PowerShell profile. Here’s how: 

  1. Check your profile path: 
    $PROFILE 
  2. Create the profile if it doesn’t exist: 
    Test-Path $PROFILE 
    # If False, create it: 
    New-Item -ItemType File -Path $PROFILE -Force 
  3. Edit the profile: 
    notepad $PROFILE 
    Add the following lines to start a transcript automatically at session startup: 
    $transcriptPath = "C:\scratch\Session_$((Get-Date).ToString('yyyyMMdd_HHmm')).txt" 
    Start-Transcript -Path $transcriptPath -Force 
    Write-Host "Transcript started: $transcriptPath"
     
  4. Save and reload the profile: 
    . $PROFILE 

Now, every time you open PowerShell, a transcript starts automatically. Closing the session stops it safely. 

Extra benefits beyond convenience 

While my initial motivation was simply to remember what I’d done, transcripts have offered more value than I expected: 

  • Compliance: Many organizations require audit logs. Transcripts can support both internal and external audits. 
  • Collaboration: Sharing a transcript with a teammate can save hours of back and forth of asking “what did you run?” 
  • Learning: Reviewing my own transcripts has been one of the best ways to identify patterns, mistakes, and opportunities to optimize work. 

Final thoughts 

If you spend significant time in Microsoft 365 PowerShell, Start-Transcript should be in your toolkit. It’s lightweight, reliable, and requires almost no effort to use. Yet the payoff is massive: better troubleshooting, stronger documentation, improved collaboration, and a trustworthy audit trail. 

In short, transcripts are far more than a convenience—they’re a habit that makes you a better, more accountable PowerShell practitioner. And when you’re monitoring changes over time, like mailbox growth or other tenant statistics, they become indispensable. 

Author

With over 20 years of experience in IT, Von Peery has seen many diverse technologies come and go. Viewing the IT world from both the perspective of a software developer when he started and that of a Network Engineer now allows Von to have a well rounded view of IT's place in business and how to effectively use technology to enhance business processes.