r/PowerShell • u/rsdovers • Mar 25 '26
Question What am I missing
I have used VSCode with Copilot and different Claude models, but I have to often correct the output generated. I have used Copilot when it was mostly code completion and now with the Plan process I am still not getting accurate code from the plan. What am I missing? I read all of the blogs and press releases where AI built this complex application without touching the code. Maybe that is it. With the new Plan process I haven't written one line of code. However, I sure have had to correct several things that were discussed in the planning process. If a simple Powershell script can't be written without a fair amount of handholding am I doing something wrong or is what I am reading not completely accurate. I can't see this taking the job of a very experienced Powershell scripter, but for entry level I see a challenge ahead.
94
u/cottonycloud Mar 25 '26
You’re seeing the gap between marketing and reality
31
u/But_Kicker Mar 25 '26
Clearly you aren’t telling it ”make no mistakes!”
9
u/Garetht Mar 25 '26
I find them great at code an open source house would use and not great at powershell. Even copilot. I can only assume it's because the model training has more non-powershell resources to pull from.
2
u/byronnnn Mar 25 '26
I find Claude and cursors Composer to work pretty good. I have a large amount of powershell scripts I’ve written that it references when building new scripts, or I can tell it what scripts to look at when I’m doing something specific. It’s not perfect, but I’ve found that I can get fully tested scripts in 30-45mins that would have taken me a few hours without it.
15
u/vermyx Mar 25 '26
I use AI as a tool and do not expect perfect code from it. Like a good drawing starts off with a skeletal sketch underneath it, this is what I expect of AI. Most of these models are trained on sources like stacking overflow where you have a proof of concept and it is gluing them together with all of the bad coding habits and what not because the expectation is that the code snippet is just a "quick and dirty" example that needs refinement. Your expectations are completely unrealistic and you are drinking the AI kook aid.
2
u/teethingrooster Mar 25 '26
Yeah it’ll basically never be 100% perfect with what we currently have. But I can get CoPilot to whip up the start of something in 45 seconds and I can tweak it enough from there. That workflow is usually faster for me to use than pull docs to remember what Test-Path returns etc. (Maybe I should learn templates / improve my typing, idk)
It does helps I don’t write more than a few hundred lines ever usually.
9
u/mnelson10000 Mar 25 '26
I got a lot of hallucinations with parameters especially with the Microsoft Graph cmdlets... I chalked it up to the rapidly changing commands and sometimes thin documentation. Plus they're going to spend a lot more resources training it on something more broadly used like JS than powershell.
1
u/rsdovers Mar 25 '26
Thank you to everyone for the suggestions and it looks like I still have a lot to learn about AI coding to get cleaner scripts the first time. I appreciate the support of the community and I look forward to learning more so I can show others on my team how they too can save themselves time spent writing powershell scripts.
1
u/justaguyonthebus Mar 25 '26
Using good software development practices makes a big difference.
And if you don't care about the code and don't need to use powershell for a specific reason, let it use python or typescript. It's so much better at those languages.
3
u/naosuke Mar 25 '26
The successful complex projects where AI is doing all of the coding has a human who has already done almost all of the engineering and has really well documented requirements. AI is just writing the code.
2
u/helpdeskimprisonment Mar 25 '26
What are you trying to accomplish? If its inventing pseudocode you may need to specify or give documentation in context. Even then, I'd never run anything generated without vetting first. I never get the desired result the first time unless it is simple.
Some of the biggest gaps I see are when working with application APIs.
2
u/TheTolkien_BlackGuy Mar 25 '26
You're not going to get perfect code from an LLM more times than not. I find what is helpful is to build a framework that it can build on top of that.
I often build modules around APIs, I will write some classes and functions that show it what I want. I will also provide the documentation from the API In those scenarios it is a lot more accurate.
YMMV
2
u/gpouliot Mar 25 '26
I've made a handful of programs in Powershell, javascript, HTML Etc. I find AI is great at simple things but then the moment your program starts getting complicated it starts making all sorts of mistakes. It frequently makes mistakes, removes existing features, adds features you didn't ask for, breaks existing features when you add new ones and often fails to correct issues because it's barking up the wrong tree.
I recommend the following:
2
u/markdmac Mar 26 '26
You really are not missing anything. AI loved to hallucinate PowerShell commands in my experience. It is great for some mundane stuff, but any real creativity still needs human development.
1
u/3StickNakedDrummer Mar 25 '26
Critical thinking is what's missing here. I've used AI to write powershell myself. I rarely get working code but it often gives me a headstart. It is also good at solving specific problems in the code. However if you take the human thinking aspect of the process out, you're asking it to do too much.
1
u/runmalcolmrun Mar 25 '26
Tell it specifically what you want. In detail. After it’s created tell it to assess and review. After that tell it to check for production readiness and prepare it for review by your senior developer. I found that making it test its solution usually brings up errors it missed when creating. I think I created a prompt so that when I tell it to “review the code” it performs a number of checks for efficiency, errors, robustness, security etc.
1
u/ReptilianLaserbeam Mar 25 '26
Previous instructions: only use cmdlets that you find in the current documentation. I'm using X.XX powershell version, only use compatible cmdlets.
1
u/Ok_Presentation_6006 Mar 25 '26
I’ve had pretty good luck with Claud 4.6 but it’s not perfect. It’s a tool to work much faster. It will create my script but might have a bug. I can typically tell it the bug and it can fix its self. Sometimes we get stuck in a fixing loop and I might need to feed it details to help it get Out of its loop. In the end it might be a 80% ai and 20% me. I also found working in smaller code batches works much better.
1
u/AistoB Mar 25 '26
I tried copilot in vscode as an experiment, it made a barely usable and terrible looking version of my request, then turned the same code over to Claude and it transformed it into a beautiful looking fully functional 1:1 realisation of what I wanted. Night and day.
1
u/RunningOnCaffeine Mar 25 '26
Gemini seems to be the best at actually following the docs, albeit you’re still really just limited to having it do one function at a time and assembling it all yourself.
1
u/mycocomelon Mar 25 '26
I use power shell on Windows, which is pretty much the common scenario. Claude code has told me that it cannot run any code on its side using windows, only Linux. So it seems to me it is not even able to test the code that it writes for power shell.
1
u/Late-Grapefruit4014 Mar 26 '26
You’re first problem is you’re using AI and you need to learn to program.
1
u/Constitutional79 Mar 26 '26
You’re not missing much. What you’re seeing is closer to reality than the marketing.
AI is good at giving you a starting point, speeding up repetitive work, and helping with structure, but it still gets things wrong all the time. A lot of those “AI built this whole app” stories leave out how much correction, prompting, testing, and cleanup happened behind the scenes.
It’s not replacing experienced scripters yet. If anything, it’s most useful in the hands of people who already know enough to spot bad output. For junior people, the bigger challenge may be learning when the AI is wrong, not just how to use it.
So no, I don’t think you’re doing anything wrong. I think you’re just seeing past the hype.
1
u/Best_Alternative349 Mar 26 '26
What sort of things are you trying to get it to do? I'm not doing anything particularly complex but it is working pretty flawless for me. I'm using it for things like making fancy reports from various API calls in Azure, Entra, Nutanix and a few other bits. I've made loads of new AD scripts that just work.
I got it to create a basic firefox extension for an outside of work project that was flawless.
Now granted. I'm not doing anything too complex but at the level I need it for it gets the job done in minutes rather than the hours it would take me.
1
u/OPconfused Mar 26 '26 edited Mar 26 '26
Download cursor or opencode and use those. Both are available via chocolatey. You'll need a license through github to access claude. It's a 10000% game changer.
Just a few days ago, I released a 4000 line feature of 85% python / 15% bash after only 2 weeks of development using claude opus 4.6 and opencode, and most of those 2 weeks was testing or distraction with other topics. Probably around 3k of those lines I did in 1-2 days of iterative development. The code writing itself was done in minutes. Zero problems or errors in the coding syntax. You just sit back and architect via prompt.
I can safely say I would have needed 2-3 months without AI. Well, technically longer as I don't know python, but even in PowerShell it would have been a couple months to iteratively move through this. But the fact I don't know Python and did this in a couple weeks is, well, it speaks for itself.
I'm just now starting to use it to update my tens of thousands of lines of powershell code. It's interpreted all of my powershell code with its various classes, transformations, parameter completers, dynamic parameters, and dozens of functions, even in context with diverse native programs, effortlessly.
Copilot in the IDE isn't there yet. The people naysaying AI haven't used it properly, either as some IDE plugin like copilot or asking chat gpt in their browser. You need the dedicated agents that scour your entire code base and can run commands on your local system. When AI has the context of your entire codebase and has agents that it can autonomously use to investigate your prompt in depth, it's the difference between a baby and an athlete.
I was skeptical for years until my company got a full github and cursor license with an open budget, told us to download cursor or opencode, and colleagues were releasing multi-month features in a week or two with even higher quality results than a "manual" implementation. When it comes to high-level languages, at least in my experience spanning shell, powershell, python, java, and golang, the art of programming is completely upended.
1
u/davy_crockett_slayer Mar 28 '26
I always manually do things before I use AI to automate the task.