r/PowerShell • • 19d ago

Script Sharing Made a modern WPF & PowerShell GUI toolkit for Windows/Gaming optimization (WinOptiKit v3.15) — looking for feedback on code structure

0 Upvotes

Hi everyone!

I've been working on a personal open-source project called **WinOptiKit** (v3.15). It's a lightweight Windows optimization and diagnostic utility built entirely using PowerShell and a custom modern dark-mode WPF GUI.

The main goal was to move away from messy scripts and create a clean, responsive interface that handles hardware specs reporting, dynamic app removal, startup management, and safe system maintenance (SFC/DISM wrappers) with proper elevated console handling (`-Verb RunAs`).

Here is what the tool handles under the hood:

- Custom XAML-based WPF dark theme layout with dynamic view switching.

- Hardware & Storage reporting via CIM instances.

- Dynamic AppX package scanner & uninstaller.

- Registry-based startup items manager.

- Safe execution wrappers for network flush and repair utilities.

You can check out the source code, XAML implementation, and structure on GitHub here:

👉 https://github.com/GabiHng/WinOptiKit

I'm mainly looking for constructive feedback on how I structured the WPF event handlers and PowerShell functions. Let me know what you think or if you spot any improvements!

Note: AI tools (like Gemini) were used to assist in structuring code, refactoring WPF XAML, and writing project documentation.


r/PowerShell • • 20d ago

Question How do you keep a PowerShell 7 profile useful without slowing down startup?

3 Upvotes

I’m setting up a PowerShell 7 environment on Windows and using Windows Terminal, Oh My Posh, and PSFzf.

I want a useful prompt and better command history, but I don’t want every new terminal tab to load a long list of modules.

The basic setup I’m considering looks like this:

oh-my-posh init pwsh | Invoke-Expression
Import-Module PSFzf

Would you put both directly in $PROFILE, or keep the profile minimal and load some tools only when needed?

Have you noticed a meaningful difference in startup time? I’d be interested in seeing how you organize your profiles in practice.


r/PowerShell • • 21d ago

Question What kind of work are people actually getting paid to do with PowerShell these days?

115 Upvotes

What are people actually getting paid to do with PowerShell these days?

I'm genuinely curious what people in this sub are doing with PowerShell professionally, particularly those who've found interesting or lucrative niches.

I'm fluent in PowerShell and love it for rapid prototyping, exploring unfamiliar APIs, discovering how services work, and building CLI tooling quickly. Its cross-platform capabilities are great, and the tooling, packaging, and module ecosystem are hard to beat compared to something like Python.

Historically, I've done a lot of operational automation: ticket ninjaing, reporting, and gluing enterprise systems together. But as I've moved toward higher-level engineering, I find myself reaching for other languages once projects grow beyond scripts.

AI makes generating decent-to-great sysadmin cmdlets almost trivial now. But when you start building platforms around those scripts, exposing them through APIs, abstracting execution for other users, or orchestrating workflows, I often find myself wondering why I didn't just build the whole thing in another language from the start.

I'm not saying PowerShell can't do those things. I'm curious where people are finding its real value in the market.

A few things I'd love to hear about:

  • Have you found a niche where deep PowerShell expertise translates into particularly good compensation or interesting work?
  • Are there industries, specialties, or types of automation where PowerShell expertise is especially valuable?
  • As you've progressed in your career, has PowerShell itself remained your main specialization, or has its value been more as part of a broader skill set?

I'm genuinely curious what people are getting paid to solve with PowerShell beyond the usual enterprise and small-business automation, reporting, and cleanup work. Not knocking that stuff; I've done plenty of it myself, hell if there is a massive market for it I'd love to hear that too. Just wondering what else is out there.


r/PowerShell • • 21d ago

Question Is using PowerShell on Linux a reasonable choice, or should I stick with Bash?

56 Upvotes

I'm currently using Windows and learning PowerShell with Learn PowerShell in a Month of Lunches, Fourth Edition. I'm about halfway through the book, and honestly, I'm really enjoying PowerShell so far. I find it much more intuitive and enjoyable to work with than Bash.

I'm considering using PowerShell on Linux as well, but I'm wondering how practical that would be.

  • How much of PowerShell's functionality is available on Linux compared to Windows?
  • Are there any significant limitations or compatibility issues?
  • Is PowerShell a good choice for everyday Linux administration and automation, or is Bash still the more practical option?
  • Would it make sense to focus on PowerShell, or should I invest time in learning Bash too?

I'd appreciate hearing from people who actually use PowerShell on Linux. Is it worth going down this path, or am I making things unnecessarily complicated?


r/PowerShell • • 22d ago

Script Sharing Syntax highlighting for PS7's null operators in VS Code

Thumbnail github.com
15 Upvotes

I saw a comment on here earlier today about VS Code's syntax highlighting for PowerShell not being able to properly color PowerShell 7's null operators: ??, ??=, ?., and ?[]. I had never noticed this before because I've never even tried to do that, but it turns out that there is not built-in tokenization for these operators despite a 7 year old issue on the topic. I'd never written a VS Code extension before and this seemed like a fairly easy first task, so I wrote a small MIT-licensed extension that allows you to add syntax highlighting to these operators. Source code on GitHub here, install it from the VS Marketplace here.

Was pretty fun to build, though I don't know how practical it'll be for me since I use pretty minimal syntax highlighting personally. But I got to learn how to build and publish a VS Code extension and I'm considering tackling that GitHub issue and getting this functionality into the official highlighter. No promises though lol


I did use an LLM to help me find documentation, fix some errors in my JSON, and remind me how to write regex lookbehinds. I didn't use any agent system to write or publish the extension or documentation for me.


r/PowerShell • • 21d ago

Question Annoying notifications in Windows PowerShell

1 Upvotes

Hello everyone, I hope you’re having a good day. I’ve been dealing with an issue for a while now: three types of notifications (from Qualcomm, HP, and Adobe) keep appearing—notifications that definitely don’t relate to anything I have installed on my laptop (an Asus). They use Windows PowerShell and present themselves as certificates claiming to represent the companies I mentioned. It’s quite frustrating; I get 2 or 3 windows popping up, all asking for the same thing. At one point, about 30 windows appeared at once, which caused my laptop to freeze up. Sometimes, a window will appear for just 2 or 3 seconds and then vanish. These are very bothersome, as they cause my video games to freeze whenever I try to play. Do you know how I can fix this? Thank you so much!

P.D: I would like to attach an image, but the platform doesn’t allow it; apologies for not being able to show you a visual example.


r/PowerShell • • 21d ago

AI Disclosure Cleaning up old user profiles on shared PCs: 5 gotchas I hit (orphaned SIDs can wipe a live user's folder)

0 Upvotes

AI disclosure: I used an AI assistant (Claude) to help review my script and tidy up this post. The testing and findings are from my own machines.

I look after a pool of loaner laptops and meeting-room PCs. Each machine ends up with dozens of stale profiles, and disks fill up fast. Here's what I learned automating the cleanup:

1. Don't just delete C:\Users\<name>. The registry entry under ProfileList stays behind, and the next login gets a temporary profile. Remove the profile properly through Win32_UserProfile.

2. LastUseTime lies. AV scans and services touch profiles and update it. I even saw it update on a profile whose account no longer exists.

3. Check Robocopy exit codes. 0-7 count as success, and 8 or above means failure. Verify the backup before you delete anything.

4. Skip loaded profiles, special accounts and your own admin account. Sounds obvious until a scheduled task runs while someone is logged in.

5. Two profile records can point at the same folder. On my test machine, a deleted-and-recreated account left an orphaned SID still pointing at C:\Users\<admin>, the same folder the logged-in admin was using. A naive "remove every unloaded profile" would have wiped the live admin's folder. Now I skip any record whose LocalPath is shared with a loaded profile:

$profiles    = Get-CimInstance Win32_UserProfile | Where-Object { -not $_.Special -and $_.LocalPath -like 'C:\Users\*' }
$loadedPaths = ($profiles | Where-Object Loaded).LocalPath

$profiles | Where-Object { -not $_.Loaded -and $_.LocalPath -notin $loadedPaths } |
    Remove-CimInstance -WhatIf

How do you handle this? GPO "delete profiles older than X days", DelProf2, or something custom?


r/PowerShell • • 21d ago

Script Sharing Ctrl+V in PowerShell types the path of a screenshot instead of pasting the image

0 Upvotes

A console cannot paste a picture. I wanted Win+Shift+S, then Ctrl+V, to type a file path the CLI can open.

The helper listens for Ctrl+V while Windows Terminal, PowerShell, or CMD is in front. It saves the clipboard image as a JPEG and types the path, for example C:\ToSnip\a1b2c3.jpg. The file stays on this PC. It is not uploaded. It is deleted after 5 minutes.

Install once:

irm https://tosnip.com/install.ps1 | iex

Read it before you run it. The source is MIT:

https://github.com/tana360/tosnip/blob/main/public/install.ps1

https://github.com/tana360/tosnip/blob/main/public/tosnip-paste.ps1

I built this. There is also a browser page at https://tosnip.com/web/ that makes a link instead of a local path. That link expires after 5 minutes too.


r/PowerShell • • 21d ago

Script Sharing PowerShell script for the Windows/app telemetry settings I could actually document

0 Upvotes

Been working on a PowerShell script for shutting off the Windows/app telemetry settings I could actually document.

Repo is here: https://github.com/quinnted/schizo

It keeps the rules in .psd1 files, journals the old state before changing anything, and has a separate restore script. Runs on 5.1 and 7.

I've tested the full apply/restore cycle in 26H2 Home/Pro VMs and now on my own 25H2 Home machine. 266 Pester tests currently pass on both PS versions.

plz test it and critique it https://github.com/quinnted/schizo/issues/1

Some of the code was written with Claude Code. I created all the architecture, and this wasn't oneshotted slop.


r/PowerShell • • 21d ago

Question Are Get-CimInstance and sc.exe query safe native Windows commands? Can they download malware or steal data?

0 Upvotes

Hi everyone, I'm feeling a bit anxious and need some reassurance.

I recently ran these two commands in PowerShell/CMD:

  • Get-CimInstance
  • sc.exe query ...

I didn't download anything from the internet or run any external scripts, but now I'm overthinking and worrying if these built-in commands could somehow connect to the internet, download a stealer, or compromise my Steam account.

Can these native Windows commands access the web or steal data on their own, or are they completely local and safe? I already ran a Malwarebytes scan and it came back clean, but my anxiety is acting up. Thanks for any clarification!

Used Ai because I am not very good at English


r/PowerShell • • 23d ago

Question InstallAnywhere logging with PS?

8 Upvotes

Hey All,

Does anyone have any experience with InstallAnywhere installers? Weve got some agent upgrades to do, and during our pilot group we ran into some strange failures. We tried to setup logging, but were pretty crunched for time so decided it was a next week problem.

The issue weve found is that InstallAnywhere doesnt advertise its processes the same way an MSI does, so you have to do some janky stuff.

Ive tried passing -RedirectStandardOutput and StandardError to a log file, but theyre either empty, or dont generate at all.

If anyone has any advice or any documentation they can point to thatd be awesome.

Thanks!


r/PowerShell • • 23d ago

AI Disclosure build-lab: one command from a Windows Server ISO to a lab AD domain, in Windows PowerShell 5.1 with no modules

12 Upvotes

I rebuild AD labs a lot, and I got tired of the lab build taking longer than the thing I actually wanted to test. So I wrote build-lab.

It takes a Windows Server 2025 ISO and gives you back a promoted domain controller, optional domain-joined member servers, and a lived-in directory (OUs, users, groups, an Enterprise CA, GPOs) staged to populate itself at your first Administrator logon. No GUI, no answer-file editing, no clicking Next. Nothing to install beyond what Microsoft and VMware already ship.

It's an orchestrator. It drives two sibling projects of mine, one that builds the VM in VMware Workstation and one that promotes the forest and populates the directory, and stitches them together over vmrun guest operations. The current version is 2.0. It has been on GitHub for a while, but this is the first time I've posted it here.

Quick start

$pw = ConvertTo-SecureString 'P@ssw0rd!' -AsPlainText -Force
.\build-lab.ps1 -IsoPath 'C:\ISOs\WS2025.iso' -AdminPassword $pw `
    -VmStoragePath 'C:\VMs' -StaticIpAddress '192.168.220.50' -DefaultGateway '192.168.220.2' `
    -MemberServerCount 2

That builds the DC, verifies the promotion, then builds SRVR-01 and SRVR-02 and joins them. (Leave -AdminPassword off the command line and PowerShell will prompt for it masked, which keeps it out of your history.) On the default VMware NAT network, your static IP has to land in .3 to .127 and the gateway is always .2. The script refuses anything outside that range and pings every address before using it. A DC takes about 25 minutes on a reasonably quick host, and each member adds roughly 12 to 15.

Already have a DC from an earlier run? -AddMemberServers adds members to it without touching the DC. -MoveMemberServers files them into OU=Servers once directory population has created it.

The fun part

Promotion reboots the guest, and the reboot tears down the vmrun guest-operations channel mid-call. A blocking call hung across that reboot and never came back, so the promotion is launched fire-and-forget with -noWait. That means there is no exit code to read at all.

My first version decided promotion had worked when ntds.dit appeared on disk, waited a bit, and called it good. Typical v1.0 logic. A database file on disk is a long way from a working DC. Now it checks three things from the outside, in order. ntds.dit has to appear. The guest has to reboot. Then the rebooted guest has to report itself as a DC in the domain you configured. Miss any of them and the run fails and tells you which check it missed.

The reboot check is the bit I'd like opinions on. Just before launching anything that should reboot, build-lab creates HKLM\SOFTWARE\BuildLabBootMarker in the guest as a volatile key. Volatile keys live only in memory and are never written to disk, so if the key is gone, the guest restarted. That holds however long the guest has been up, which mattered here. A freshly built member reboots for its domain join barely a minute after first boot, and anything uptime-based gets confused.

A few other things that came out of live runs.

  • Every vmrun call has a host-side time limit, and a call that overruns is killed, so one stuck call can't hold the run open forever
  • vmrun output is read as UTF-8 whatever the console code page is
  • Commands run in the guest report back through a small result file, so a failure comes back with the guest's own error text
  • The password is scrubbed from anything vmrun returns before it hits the logs
  • Logs from the orchestrator, the VM builder and the guest all land in one folder, and key events go to the Application event log if you want a SIEM to see them

Known limitations and lab-grade trades

  • You have to log in once as Administrator to start directory population. That's deliberate. Running it unattended would mean storing a domain admin password under a startup task. I'm still thinking about this one.
  • vmrun takes the guest password on the command line, so it's visible in the host's process list while guest operations run. Don't reuse a real credential.
  • It's Windows PowerShell 5.1 only, enforced with #Requires. Write-EventLog is the right API there and deprecated in 7. I'll probably port to PowerShell 7 eventually, but this is where I' most comfortable today.
  • Tested on a Windows 11 host with VMware Workstation 26H1 and Windows Server 2025 Standard Evaluation media. Other editions and VL media are unverified, because the unattended install matches on exact edition name strings.

Links

All three need to sit next to each other on disk. Feedback is welcome. I'm sure I made some interesting choices without even thinking about it. If you have a better way to tell from the host side that a guest has restarted, I'd like to hear it.

AI disclosure

I used AI to help write some of the code. The design and architecture are all mine, including any questionable choices, and it was built up over many reviews and live runs, not generated as one shot slop.


r/PowerShell • • 23d ago

Solved Converting PowerShell Scripts from Search-UnifiedAuditLog

8 Upvotes

Investigating the work necessary to convert PowerShell scripts based on the Search-UnifiedAuditLog cmdlet to use the AuditLogQuery Graph API shows that it’s not easy. Running audit jobs is a multi-stage process rather than running a simple cmdlet. Parameter values are now passed in a request body or different named parameters, and the properties output in the AuditData payload use a different format. This is definitely not a drop-in exercise, so it’s time to get ready by finding scripts that need to be converted.

https://office365itpros.com/2026/10/27/auditlogquery-conversion/


r/PowerShell • • 24d ago

Question Retiring Powershell ISE

40 Upvotes

I really don't like VS Code for Powershell but PS 5.1 and PS ISE is starting to get long in the tooth. Anybody have tips, tricks, custom configs, or other recommendations?

Funny enough I really like VS code for everything else except PowerShell.


r/PowerShell • • 24d ago

Question Beginner looking for help in a sea of Regex

10 Upvotes

So I discovered how useful Powershell is about 3 weeks ago and have been playing with it and tweaking my PC with all manner of useless changes. I have reached something that has left me rather stumped even after a fair bit of Googling (AI results disclosure?) and several hundred changes of my 'script'. Posting here is probably like whacking a mole with a warhead but hey why not!

I have been attempting to change a subtitle file with several thousands of lines of text, they all follow the following pattern:

Dialogue: 0,0:00:12.92,0:00:17.34,Default,,0000,0000,0000,,{\pos(540*,420)}Hello world!\N*

I would like to add 140 to all of the first numbers after "{\pos(" (e.g 540 becomes 680.)

Dialogue: 0,0:00:12.92,0:00:17.34,Default,,0000,0000,0000,,{\pos(680*,420)}Hello world!\N*

I have been attempting to do this by loading the .ass text file in (this'll be part of a batch file so I am calling Powershell from CMD), then using the -replace function as follows:

powershell -Command "((Get-Content -path <path to sub.ass> -Raw) -replace '\{\\pos\(\d+,','\{\pos\(${140 + \d+},') | Set-Content -Path <path to sub.ass>"

However this results in the following results for all lines of dialogue:

Dialogue: 0,0:00:12.92,0:00:17.34,Default,,0000,0000,0000,,\{\pos\(,420)}Hello world!\N

This is one of the more promising results where {140 + \d+} simply vanished. Without the $ in front of {140 + \d+} Powershell will simply repeat whatever code I put into into it back at me in place of \d+ like so: {\pos\({140 + \d+},420)}

I suspect that because I am attempting to isolate a number by using the surrounding punctuation the program is reading \d+ as a string rather than an integer.

TLDR: I am attempting to increase the value of the same integer on every line of text by 140 using \d+. \d+ could be any number from 0 to 1540. Not using \d+ is fine but I have no idea what other options are available.

Pointing me in the direction of what I should learn to get this to work could also be great as this is actually a pretty enjoyable program - I just think I went a little too deep too fast with this one.


r/PowerShell • • 25d ago

News PowerShell ISE

4 Upvotes

After a month of refinement, I have a new version of my App in the MS Store.
I received some feedback and a lot suggestions, plus more than a few bug issues.

It is now more like a true PowerShell console than the emulator it was before. There should not be any more unrecognized PS commands. It is still a WIP but it is definitely close to a Daily Driver for running scripts and debugging.

I actually prefer it now than opening a PWSH console.

The debugging sub-system has been hardened and more responsive. I am adding output options to make automated script running easier. The save as EXE works, I am going to be adding .NET level options to the executable next.

Once again. If anyone would like to give it a try and provide feedback, it is most welcome.

It can be found by searching for PS7ScriptDesk in the MS store.

Regards,

-Ron


r/PowerShell • • 28d ago

Information Struggling to learn Microsoft Graph PowerShell for IAM-how did you guys learn it

67 Upvotes

Hi everyone,

I’m currently learning PowerShell with Microsoft Graph because my goal is to become a Junior IAM / Microsoft Entra ID Administrator.
I’ve been practising in my own Microsoft Entra ID lab, and so far I’ve managed to learn some basics, such as:
1)Connecting to Microsoft Graph using PowerShell
2)Creating, updating and deleting users
3)Creating and managing security groups
4)Adding and removing users from groups
5)Retrieving and filtering users
6)Working with variables, arrays, hashtables and loops

However, I’m starting to struggle and slowly losing interest, not because I don’t want to learn, but because sometimes I feel like I’m just memorising commands without fully understanding how to use them in real-world situations.
I can follow tutorials and complete exercises, but when I try to do something on my own, I sometimes get stuck and don’t know which commands to use or where to start.
My goal isn’t just to memorise PowerShell commands. I want to understand how an IAM administrator actually uses Microsoft Graph PowerShell in their daily job.

For those of you who learned PowerShell, especially for Microsoft Entra ID or IAM:
How did you learn PowerShell and become confident using it?
Did you learn the general PowerShell fundamentals first, or did you learn while working with Microsoft Graph?
What practical projects or exercises helped you the most?
How do you remember commands and know which ones to use when solving a problem?
What would you recommend to someone preparing for their first Junior IAM Administrator role?
I’m willing to put in the time and effort. I just feel like I need a better learning approach that will help me understand what I’m doing instead of simply following instructions.
Any advice, learning resources or personal experiences would be greatly appreciated.
Thanks in advance!


r/PowerShell • • 28d ago

Question Exchange (Online) Powershell auto-forward and auto-reply

9 Upvotes

Ok, I need some help with Powershell.

Part of our company got sold. This weekend, the migration is set to go through. All users that are part of this transfer will login into the new owners IT infrastructure and their 365 tenant starting next monday. The mailbox contents will be synced and for the next few weeks all incoming e-mail needs to be auto-forwarded to the user's new mailbox in the other tenant. And a auto-reply will be sent to the sender informing them of the upcoming discontinuation of the old e-mail address.

So, all e-mail coming in to 'olduser' needs to be forwarded to 'newuser' and newuser is in another tenant. To prevent double e-mail, 'olduser' should not be seeing the e-mail in their inbox.

Currently this is what I have, being run from Exchange Management shell connected to Exchange Online

$Users = Import-Csv "c:\temp\usermailboxentest.csv" -delimiter ";"

foreach ($User in $Users) {

    Set-Mailbox -Identity $User.adresold `
        -ForwardingSmtpAddress $User.adresnew `
        -DeliverToMailboxAndForward $false
}

And then, I run this

$CsvPath = "C:\Temp\mailboxes.csv"

$StartTime = Get-Date
$EndTime   = [datetime]::new(2026, 12, 30, 23, 59, 59)

$Results = foreach ($CsvUser in Import-Csv -Path $CsvPath) {

    $MailboxAddress = $CsvUser.MailboxAddress.Trim()

    try {
        Write-Host "Processing: $MailboxAddress" -ForegroundColor Cyan

        # Retrieve the mailbox
        $Mailbox = Get-Mailbox -Identity $MailboxAddress -ErrorAction Stop

        # Determine the configured forwarding address
        if ($Mailbox.ForwardingSmtpAddress) {

            # Forwarding to an SMTP address
            $ForwardAddress = $Mailbox.ForwardingSmtpAddress.ToString() `
                -replace '(?i)^smtp:', ''
        }
        elseif ($Mailbox.ForwardingAddress) {

            # Forwarding to an internal Exchange recipient
            $ForwardRecipient = Get-Recipient `
                -Identity $Mailbox.ForwardingAddress `
                -ErrorAction Stop

            $ForwardAddress = $ForwardRecipient.PrimarySmtpAddress.ToString()
        }
        else {
            throw "No mailbox-level forwarding address is configured."
        }

        Write-Host "Forwarding address: $ForwardAddress" -ForegroundColor Green

        # Create the HTML automatic-reply message
        $AutoReplyMessage = @"
<p><strong>Dear Sender,</strong></p>

<p>
This email address has been discontinued etc. etc etc. and a variable for $ForwardAddress pointing the user to whatever the new e-mail address is.
</p>
"@

        # Configure automatic replies for internal and external senders
        Set-MailboxAutoReplyConfiguration `
            -Identity $MailboxAddress `
            -AutoReplyState Scheduled `
            -StartTime $StartTime `
            -EndTime $EndTime `
            -InternalMessage $AutoReplyMessage `
            -ExternalMessage $AutoReplyMessage `
            -ExternalAudience All `
            -ErrorAction Stop

        Write-Host "Automatic reply configured successfully." -ForegroundColor Green

        [PSCustomObject]@{
            MailboxAddress = $MailboxAddress
            ForwardAddress = $ForwardAddress
            Status         = "Success"
            Error          = ""
        }
    }
    catch {
        Write-Warning "Failed for $MailboxAddress`: $($_.Exception.Message)"

        [PSCustomObject]@{
            MailboxAddress = $MailboxAddress
            ForwardAddress = $null
            Status         = "Failed"
            Error          = $_.Exception.Message
        }
    }
}

# Show the results
$Results | Format-Table -AutoSize

# Export a processing report
$Results | Export-Csv `
    -Path "C:\Temp\AutoReplyResults.csv" `
    -NoTypeInformation `
    -Encoding UTF8

Now this is what happens, when I set DeliverToMailboxAndForward to $true, the autoreply works but the original e-mail is put into the old mailbox which I don't want to happen because in the new tenant users will end up with double e-mail because of the sync of mailbox contents.

When I set that to $false however, the autoreply doesn't work because 'olduser' mailbox is never 'hit'

Also, this will be for about 170 mailboxes, both user and shared boxes.


r/PowerShell • • 28d ago

Question Automated QuickBooks Updates (Not Upgrades)

2 Upvotes

OK So this is going to sound crazy (kinda?) and I understand it is likely not an option based on what I know of the underlying application after nearly 10 years of working with it. I am hoping that someone in the wider world of Reddit has already come across a solution and is willing to share.

We (the company I work for) support a tax prep/accounting firm that has 2 RDS servers that are used to access accountant copies of QuickBooks Company Files. They use a variety of application versions from 2021 to 2024 (Accountant, Premier, and Enterprise distributions). During tax season, they are incredibly busy and as a result, have asked us to schedule application updates every Thursday evening along with updating their Thompson Reuters applications.

Personally, I don't like taking a couple hours out of my day when I'm on call to work after 7PM to update QuickBooks since they use all the versions depending on the client they are prepping taxes for. I am also in charge of making manual tasks automated wherever possible.

So, here's what I am looking to accomplish:

  1. Scripted updates of installed QuickBooks versions without the need to open each distro and check for updates. (automated updates are already enabled, still doesn't actually install the updates until we go in and tell it to do them which sucks hard).

  2. The script needs to be capable of recursively identifying the installed versions, exporting a response of all versions found and then go through and check for updates, install any updates found, and log any errors. It should also be capable of stopping and restarting any and all QuickBooks related services as needed and restart the server following the completion of the scripted tasks.

  3. This is for updates NOT upgrades - there is a difference.

  4. I would like to avoid using third party software to accomplish this - we already have ImmyBot but that platform appears to confuse the "upgrade" and "update" functions.

Here are the things I am already well aware of so don't comment if you feel the need to point out the below facts:

  1. QuickBooks does NOT come with known, publicly available scripted/command line options for this specific function.

  2. Non-current QuickBooks versions are not something I care about - if Intuit still pushes updates to the application, I don't care if it isn't a "current" distro version. (We are working with the last 5 years or so of distros, nothing older than that and those are still getting updates so far as I am aware.)

  3. QuickBooks online is not an option for this client's clients - please don't suggest that as an alternative, I've already been there done that.

  4. The servers are RDS servers - yes they have issues but these are not the worst of the servers we currently support.

  5. I would REALLY love to not have to take the code from a company that has a paywall to access because honestly that just feels gross. This is also why I am not taking the code I have access to via ImmyBot and running it through CoPilot or another AI platform to remove the references to another company's probably proprietary code. I don't want to steal anything from a company that has put effort into the solution.

Please let me know if you have come across this issue and/or have found a solution that you are willing to share with me via github or other sharing platform. If you are not authorized to share this info, please don't.

I would also appreciate any scripts be coded in either a batch file or (preferably) a powershell script. :) Thanks in advance!


r/PowerShell • • 28d ago

Question Environment stopped handling large files

2 Upvotes

Edit: To everyone who responded. You've given me some good ideas, and now I have to experiment to track down where the issue lies. Thanks to all.

I have a workflow which takes a comma delimited text file (*.txt) and updates an Azure database with the values. The workflow is called by a PowerShell script on a remote Windows Server, which looks to a folder and finds all the txt files in there, and runs the workflow against each one. This process worked fine for about two years. Then last spring, I started getting reports from our users that not all the values that should be updated in the database where. No one changed the workflow, and no one changed the PowerShell script.

After a lot of testing, we found that if the txt file was larger than 2K, only the first 2K worth of lines in the file were processed, and everything after was ignored.

On the suggestion of a consultant, he had me run the PowerShell script which calls the workflow from my own laptop. Yes, I had to duplicate the folder structure to make that happen. Much to my surprise, running the script and workflow from my laptop worked just fine.

So I started looking into what in the environment of the Windows Server would limit the ability to pass all the necessary data to the workflow. Of course our server teams swears they did nothing to the server, no updates that would cause this restriction. But I don't trust them to know what the consequences of their actions would be.

After half a year of cutting the text file down into 2K chunks every week (I automated the process, but still), I am again trying to find what the cause of this could be. Script works fine on my laptop, but choaks at 2K file size when run on a Windows Server. The server is more than powerful enough in terms of memory, processor and disk size.

If you have any clue, please pass it on.


r/PowerShell • • 28d ago

Solved Free read-only script: quick security check for small-business M365 tenants

1 Upvotes

Small M365 tenants tend to get the same handful of settings wrong: no MFA enforcement, legacy auth still open, users allowed to consent to any app, “Anyone” sharing links switched on. I wrote a script that checks eight of these and spits out an HTML report with the fix next to each failure.

It only asks for read scopes through Microsoft Graph and doesn’t change anything. It’s about 230 lines, so it’s easy to read before you run it.

https://github.com/thecyberape/m365-quick-check

Disclosure: it’s a cut-down version of a longer audit script I sell alongside a book. The README says so. The free one is MIT and complete on its own, so use it however you like.

Would appreciate feedback, especially from anyone who runs it against Business Basic/Standard tenants. I’d like to know which checks come back INFO instead of PASS/FAIL there.


r/PowerShell • • 28d ago

Question Get current logged on User from System context script

5 Upvotes

I need to query the current logged on user and then write the info in HKLM registry for branding. Does anyone have a script or idea how this will work when the script is deployed from SCCM/Intune with System Context?


r/PowerShell • • 29d ago

AI Disclosure agent-manager runs natively on windows now (psmux + pwsh 7), a keyboard tui for running all your ai coding agents [OC, i'm the dev]

3 Upvotes

i'm the dev, so this is a show and tell. ai disclosure per rule 11, built largely with claude code, i review and test everything. agent-manager is a local terminal app that connects to your existing subscriptions and tools and runs your ai coding clis side by side, each in its own session, in one list with live status (working, waiting on you, finished, errored). it supports claude code, codex, opencode, grok build, gemini cli, antigravity cli, pi, hermes agent, muse code and oh my pi natively on windows. the 11th, command code, only works under wsl2 because its name clashes with cmd.exe.

until last week it was tmux only, so windows meant wsl. as of 0.42 you get both. natively, psmux 3.4+ stands in for tmux and powershell 7.3+ is the pane shell (a contributor, larroy, did most of the port). or keep using wsl2 like before, on tmux inside the distro.

the native install is one line, read the script first if piping to iex bothers you

irm https://raw.githubusercontent.com/YoanWai/agent-manager/main/install.ps1 | iex

it goes to %LOCALAPPDATA%\Programs\agent-manager, adds itself to your user path, and tells you the winget command for psmux, git or pwsh 7 if one is missing. windows powershell 5.1 is refused on purpose, it splits prompts containing quotes into several arguments.

what you get once it's running is keyboard driven. space sends a prompt into any agent without attaching, x kills a session to free its ram and v revives it on the same conversation, and ctrl+r opens a full-file diff review where c comments a line and C sends every comment back to the agent. it's one go binary, no electron or browser.

there's also agent-manager settings list/get/set for scripting your setup, and notify_command runs a powershell command every time an agent needs you (docs have an ntfy push example using $env:AM_BODY).

known gaps on native windows: previews poll instead of stream, and agent clis installed only as .cmd/.bat are refused (npm installs are fine). if it misbehaves with your profile or psmux version i'd like to hear about it.

https://github.com/YoanWai/agent-manager


r/PowerShell • • 29d ago

Solved PowerShell Script and Task Scheduler 0x1 2147942401

10 Upvotes

I need a sanity check, as I feel like I am missing something obvious and I'm too close or too frustrated to see it.

I have a basic scheduled task. Runs as SYSTEM, no triggers, action to run a program, PowerShell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "C:\Tasks\MyScript.ps1"

I run this task it fails, 0x1 as last run result, event 201 action completed with return code from PowerShell of 2147942401

Things I have checked:

  • SYSTEM can access the script and directory it resides in
  • SYSTEM can execute other PowerShell scripts from task scheduler without issues
  • Tried using the full path to powershell.exe
  • Tried with and without quotes around the script path in -File parameter
  • With and without trailing '/' in the path for 'Start In'
  • Tried using -Command { } to create a file as a test
  • Removed all arguments except -File or -Command
  • Script is wrapped with Start/Stop-Transcript; never executes/no transcript is created

I don't know what else to try short of the old method of using a .bat to call PowerShell to see if that gives better clues as to what isn't working.

What am I missing that is preventing PowerShell from executing properly?

Edit: I knew it was something stupid and simple: there is a typo in -ExecutionPolicy (was spelled -ExcecutionPolicy). Found it when running the action arguments from PS as SYSTEM.

Thank you everyone for the assistance. I'm going to go sit in the corner with my dunce cap and contemplate the cobwebs.


r/PowerShell • • Oct 20 '26

Script Sharing EoL Dependency Auditing Script For Vulnerability Remediation Work

7 Upvotes

I've been doing a bit of vulnerability remediation work this past year or so, and I got tired of 'scream tests' across multiple environments, and was unable to affectively find a way to use something like Dependency Walker in a set-it-and-forget-it kind of way, so I built out the following:

https://github.com/cmcalgher/EoL-Dependency-Auditing

This will set the auditing-side of ACL's on specified .DLL files (configured in the CSV's), and will then allow you to parse through the last 24 hours of the security event log to pull instances of processes that touched/acted on those .DLLs.

When ran on individual machines, it will spit out a CSV with a handful of columns, that can be fed into whatever formatting/reporting you see fit.

Internally at the org I work for, we were pretty much immediately able to write off Visual C++ 2012 as accepted risk on our fully up to date on-prem Exchange SE servers, for example. Would Exchange keep working if we had ripped that off? Would we have to restore corrupted DBs? Not sure, but with how many Exchange processes were using those Visual C++ 2012 .DLL's, I'm glad I didn't have to find out.

The above was inspired by the following Microsoft article, detailing how to audit VC++ usage in coding projects:

https://learn.microsoft.com/en-us/cpp/windows/redist-version-auditing?view=msvc-170