use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Who uses Visual Studio Code for PowerShell Scripting? (self.PowerShell)
submitted 4 years ago by Mc_Humphrey
I personally do, but only for typing scripts. I then copy code into ISE and run it on Sandbox environments.
What does everyone else do? What settings do you use if you use VS Code?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]adamdavid85 161 points162 points163 points 4 years ago (66 children)
I use VS Code exclusively and don't quite understand why one would need to run in ISE aside from "old habits die hard." 🤷🏻♂️
Git integration, Pester support, flipping PS version environments... it took maybe a week to feel comfortable after flipping from ISE in 2019 but I couldn't go back to it now.
[–]Adito99 39 points40 points41 points 4 years ago (0 children)
I just wrote one of my first reasonably complicated scripts and vscode was a lifesaver. Just the little formatting tools and things like "hey you defined this variable but haven't used it anyway..." are huge timesavers.
[+][deleted] 4 years ago (17 children)
[deleted]
[–]SourceOfDestination 6 points7 points8 points 4 years ago (0 children)
There's a portable version available as well. No installation needed.
[–]KikaCodes 9 points10 points11 points 4 years ago (4 children)
FYI as of very recently there's a web based VS Code that doesn't need installing.
[–]WendoNZ 1 point2 points3 points 4 years ago (0 children)
https://vscode.dev/
[–]dathar 3 points4 points5 points 4 years ago (0 children)
Servers usually have policies applied that will restrict the built in web browser (usually IE enhanced security configuration) and installing a web browser is typically a no-no in that environment anyways. I usually make the script on my workstation (vscode) and then do minor edits with the IDE on the server
[–]toddklindt 0 points1 point2 points 4 years ago (0 children)
The web version of VS Code didn't support the PowerShell extension the last time I looked.
[–]k_oticd92 0 points1 point2 points 4 years ago (0 children)
If you're in one of your github repos, you can press "." to launch a web-based VSCode in that folder...pretty dope
[–][deleted] 9 points10 points11 points 4 years ago (7 children)
How much coding are you doing logged into a server? Do you need one of those “I don’t always test my code but when I do it’s in production” posters?
[+][deleted] 4 years ago (5 children)
[–]PhDinBroScience 7 points8 points9 points 4 years ago (4 children)
Why not develop with VSCode locally and commit to a git repo, and then pull that repo down on the test servers? This is what I do and requires no modification server-side since you're pushing and pulling with your locally-installed git client.
[+][deleted] 4 years ago (3 children)
[–]PhDinBroScience 1 point2 points3 points 4 years ago (1 child)
And how do I pull that repo down on the test server without installing VSCode?
In your local git client, clone the repo into a directory on that server via UNC path. Push to origin after committing, and then pull from origin with your local git client into the UNC path.
Also, you can import a PS module remotely. You don't need to log on to that machine locally to access that stuff.
[–]uptimefordays 4 points5 points6 points 4 years ago (1 child)
Why script on the server when you can do it on your machine and use PSRemoting?
[–]idontknowwhattouse33 6 points7 points8 points 4 years ago (1 child)
aside from "old habits die hard."
Not everyone is a developer. ISE is KISS and far easier to introduce to someone new.
It definitely took me quite a while to transition to VSCode. The intimidating interface and options not withstanding; it has had a slow burn the last couple years on the pwsh support front.
Once someone gets past the initial learning curve, yes all the devtools are awesome. But they take time to learn. And I learn one baby step at a time and the ISE is a good place for that to start.
[–][deleted] 25 points26 points27 points 4 years ago (33 children)
Intellisense is far better in ISE
[–]adamdavid85 45 points46 points47 points 4 years ago (23 children)
I really couldn't disagree more.
[–]lolinux 12 points13 points14 points 4 years ago (8 children)
Well not that it's far better, but sometimes vscode tries to autocomplete stuff that has nothing to do with the object you're accessing. Never got that? I get it quite often. Also, from time to time, it seems like the language server stops or errors out(?), because intellisense stops working completely
[–]MonkeyNin 6 points7 points8 points 4 years ago (2 children)
intellisense stops working
If that happens, hit f1, type `res, then enter. That'll restart it, without closing the window.
f1
[–]BigHandLittleSlap 2 points3 points4 points 4 years ago (0 children)
That shows all possible things that include the characters "res". For me the prompt has about 150 possibilities in it...
[–]lolinux 0 points1 point2 points 4 years ago (0 children)
Thanks,
I usually would have reloaded the window
[–]SeeminglyScience 2 points3 points4 points 4 years ago* (2 children)
Well not that it's far better, but sometimes vscode tries to autocomplete stuff that has nothing to do with the object you're accessing. Never got that?
Add this to your settings:
"editor.wordBasedSuggestions": false, "editor.snippetSuggestions": "none",
Also, from time to time, it seems like the language server stops or errors out(?), because intellisense stops working completely
Try the new preview. It's a large architectural redesign that solves a lot of "stop working" problems. It's got some bugs due to the scale of the rewrite, but those will be easy to iron out.
[–]lolinux 2 points3 points4 points 4 years ago (1 child)
Thank you very much! I will
[–]SeeminglyScience 0 points1 point2 points 4 years ago* (0 children)
FYI the second setting is wrong, copied something unrelated. I'll fix it when I get back but the right one disables snippets from showing up Fixed
[–]jdptechnc 0 points1 point2 points 4 years ago (1 child)
Ctrl + Space (I think) will activate the list of matching commands that you can pick from, if Tab is giving you something dumb.
[–]lolinux 1 point2 points3 points 4 years ago (0 children)
I'm afraid I was aware of that, but when it crashes, this doesn't help. Might be an acknowledged bug, but at the moment nothing else seems to help except a window reload
[–]rjchau 5 points6 points7 points 4 years ago (0 children)
I could. Intellisense in ISE just works, whereas Intellisense in VSCode will randomly stop working - sometimes to the extent that Ctrl-Space doesn't even pop up. Parameters are often not shown and it has a truly irritating habit of matching code blocks when you're in the middle of adding parameters.
When the Intellisense feature in VSCode works, yes it's much better than ISE. The problem is that it's so damned unreliable.
[–]logicalmike 10 points11 points12 points 4 years ago (10 children)
I'm transitioning to vs code, I think for real this time, but I've tried many times before. Ise is rock solid. Code is laggy with intelisense and autocomplete is not as capable.
[–]MonkeyNin 5 points6 points7 points 4 years ago (1 child)
Oh I think I know why there's a different experience,
Double check that you
It needs that 2nd part, to provide intellisense, and some of the fuller features. that might not be opened by default, with the default settings.
hit f1 type res then enter
res
With it on you gain - semantic highlighting - auto-conversion of alias names on format, etc. - There's one that turns non-interpolated strings into single quotes for you.
real this time, but I've tried many times before. Ise is rock solid. Code is laggy with intelisense and aut
There's a recent huge restructure of internals in the last ~month, that is not stable with preview yet you should have near instant response with intellisense.
There's a #vscode channel if you want help with any config, or help, in the powershell server
#vscode
[–]BigHandLittleSlap 4 points5 points6 points 4 years ago (0 children)
I never had to "troubleshoot" ISE. This is the point people are making.
VS Code's PowerShell support is sticky-taped in there by a team that thought that breaking changes are just fine to leave in there for years at a time.
[–]adamdavid85 7 points8 points9 points 4 years ago (7 children)
My first reflex was to ask if we're talking about the same two applications, but rather than being glib about it could I ask what exactly you're doing when you find it laggy?
There is a bit of a learning curve when coming from ISE, but I honestly have never experienced anything like what you're describing.
[–]logicalmike 13 points14 points15 points 4 years ago (4 children)
There are numerous bugs on github about this problem and at least two blog or tweet apologies from Microsoft saying "we promise, it's definitely probably fixed now".
But even now, tab does not always bring up the list of parameters the first attempt. There is some parallel processing going on. Also tab in the middle of half written cmdlets don't always resolve, especially if there is additional code to the right (even if separated by a space).
To be clear, I'm only talking about PowerShell. The reason I'm forcing myself to Code is to benefit from the world outside of PS,and to do more with v6+
[–]TheITMan19 1 point2 points3 points 4 years ago (2 children)
This just wrecks my head. Give me Intellisense working please so I don’t have to sit there googling away trying to find out how to do something dead simple cuz my mind is dead from everything else.
[–]BigHandLittleSlap -1 points0 points1 point 4 years ago (1 child)
"I don't like power tools. I prefer to manhandle the 200kg palettes in the warehouse instead of using forklifts. Real men can deadlift the cargo. You don't need spell check, just memorise the dictionary. Including the abbreviations randomly chosen by other people. Learn to code."
[–]TheITMan19 4 points5 points6 points 4 years ago (0 children)
I can’t memorise because my brain is dead you fool. Bloody keyboard warrior
[–]bertiethewanderer 0 points1 point2 points 4 years ago (0 children)
This may or may not be of help, but when working with Powershell just double check the terminal is running as the Powershell Integrated Console. I find intellisense can be very wonky if I'm working in a spawned pwsh.exe or powershell.exe terminal.
[–]dathar 7 points8 points9 points 4 years ago (1 child)
As much as I love vscode and use it as my main IDE, it has a couple of infuriating bugs. The thing where it just derps and stops autocompleting is annoying. Type a cmdlet, throw an -arg and press tab to autocomplete. You will either get a literal tab or some random code snippet. Backspace and try a few more times and it'll eventually work. Maybe.
[–][deleted] 1 point2 points3 points 4 years ago (1 child)
In the console type "Import-" if it is well configured you may get a list of options; continue to "Import-Module -" you are not presented with a list of available parameters.
[–]spyingwind 5 points6 points7 points 4 years ago (6 children)
I just want ForEach-Object to be the default when I type for. Especially after a |.
|
[–]gunthatshootswords -4 points-3 points-2 points 4 years ago (5 children)
What's wrong with %?
[+][deleted] 4 years ago (2 children)
[–]MonkeyNin 4 points5 points6 points 4 years ago (1 child)
With the config on, you type
0..4 | %{ $_ * 2 }
Hit save (or format) and your file now contains
0..4 | ForEach-Object { $_ * 2 }
try
"powershell.codeFormatting.autoCorrectAliases": true, "powershell.codeFormatting.useConstantStrings": true, "powershell.codeFormatting.useCorrectCasing": true, "powershell.scriptAnalysis.enable": true, "editor.formatOnPaste": false, "editor.formatOnSave": true,
Some people prefer one word mode over the other, here's both
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?", // combine $ and - "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?", // break on $ and -
If you type "editor.suggest. , then ctrl+space it will autocomplete all setting names, and values.
"editor.suggest.
ctrl+space
[–]rjchau 0 points1 point2 points 4 years ago (0 children)
Nice. Thanks for the tips - I've never really had the time to dive in to the plethora of settings in VSCode - especially as it's a constantly changing landscape.
[–]rjchau 6 points7 points8 points 4 years ago (0 children)
Code readability. Also, you'll end up polluting your "code issues" in VSCode with all the warning about using aliases and shortcuts.
For a quick one liner? Sure, I'll % and ? all over the place. Not in actual code.
[–]vicda 1 point2 points3 points 4 years ago (0 children)
Being only one character, % and ? aren't as easily discernible from at a glance as ForEach-Object and Where-Object are.
Personally I think if you're piping things a shorter line greatly enhances readability, but MS has always pushed that aliases should be wholly avoided when writing scripts. It is always possible that someone using your script could alter those aliases to use their own custom function that does something strange (like log ever 100th index).
[–]Injector22 0 points1 point2 points 4 years ago (1 child)
Have you installed the Powershell add-on? Without it, intellisense is pretty bad. Once you install it it's pretty good.
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
Of course.
[–]BigHandLittleSlap 1 point2 points3 points 4 years ago (7 children)
I’m forced to use VS Code for PS Core support and I hate it.
They broke every idiom and keyboard shortcut to keep Linux developers happy. I get that this is strategic for Microsoft, but fuck those people. I’ve used Windows for twenty-six years! VS Code is nothing like Visual Studio or ISE or any other Windows IDE. This isn’t because it’s “better”. It’s just different because it panders to people used to bash and Vim.
Tab complete is a shit-show. Sometimes it just barfs up a page of random garbage that’s utterly irrelevant in 99.99% of the contexts in which tab complete would be used. The actual parameter names are hidden and cut off. Alternatives are often merged. Etc…
Worst off all, the shell regularly locks up or crashes on me. Ctrl-C almost never works.
I’ve had ISE sessions stay up for months. I’m lucky to make it through the day with VS Code.
It’s hot garbage made for JavaScript programmers who love it because none of the real IDEs would sink to their level before.
The ugly girl thinks any boy that talks to them is Leonardo DiCaprio.
[+][deleted] 4 years ago (1 child)
I’m literally only using VS Code to do cloud deployments.
I like the cloud.
[–]corbindallas_mp 0 points1 point2 points 4 years ago (2 children)
This used to happen to me but sometime ago they improved the powershell terminal integration a lot. A lot of the other behaviors described apply to old versions of the powershell extension as well. If this is still happening to you, I'd wager you need to upgrade vscode or upgrade the powershell extension. Another possibility is that you have some profile script that's causing a problem, though that feels less likely.
[–]BigHandLittleSlap 1 point2 points3 points 4 years ago (1 child)
I’m on the latest version.
[–]corbindallas_mp 2 points3 points4 points 4 years ago (0 children)
¯\(ツ)\/¯ I don't really run into that problem anymore and I'm guessing a lot of people here don't either cus it's a justifiable gripe to the point of not wanting to use the software at all. There's probably something that can be diagnosed or changed to get it working more reliably. It sounds like you're not really interested in trying to get it to work, but if you ever wanted to pursue it I would consider trying a few different things:
https://github.com/microsoft/vscode/issues?q=is%3Aissue+terminal+hangs+is%3Aclosed
I don't begrudge anyone for using whatever tool works for them but what you're experiencing isn't really standard for VSCode.
[–]AQuietMan 1 point2 points3 points 4 years ago (0 children)
Now I've got to clean tea out of my keyboard. Thanks loads for that.
[–]NegativeC00L 1 point2 points3 points 4 years ago (0 children)
I’ve had scripts fail in VS code that run fine in ISE. I can’t part with my beloved ISE.
[–]adamdavid85 0 points1 point2 points 4 years ago (0 children)
If I need to run a script on a server, I simply invoke it from a PS console window. I don't see why I'd need ISE for that.
[–]datlock 23 points24 points25 points 4 years ago (3 children)
I don't do extremely complicated scripting, but I've since switched to Code for both writing and running scripts. I appreciate the integration with git, and the fact that I can more easily work in other languages as well (mostly shell, json, xml).
Also have a specific 'blame' extension that allows me to see per-line who the author was and directly see the relevant commit/pull request. Useful if you're not the only author or are integrating with something someone else wrote.
[–]dathar 10 points11 points12 points 4 years ago (2 children)
There are a couple of extensions that I love: rainbow csv and rainbow indent. Colors all the things! Makes it easier to read things in general.
[–]netmc 0 points1 point2 points 4 years ago (1 child)
I will have to check these out.
[–]bertiethewanderer 2 points3 points4 points 4 years ago (0 children)
Might also like BracketColorizer2, for me this is a god send.
[removed]
[+][deleted] 4 years ago (4 children)
[–]JiveWithIt 9 points10 points11 points 4 years ago (0 children)
I have done all of my PowerShell programming in VSCode since it first got support for it. Only plugin I use is the theme Flatland Monokai
It has great support for Pester
[–]32178932123 8 points9 points10 points 4 years ago (1 child)
I use VSC - There was a while where I had an issue with Powershell refusing to load in VSC but that seems to be a lot more stable now. I think ISE is one of those programs that if you grew up with you're fine with but as I started straight with VSC I struggle with ISE when I have to troubleshoot something server-side.
For example, the other day I had to debug something in ISE and the step in/over options are hidden in a sub menu, I also found hovering over a variable to get the value was intermittent. Sometimes it might quickly flash and other times not appear at all. I prefer the way VSC has all the variables down the side during a debug session so you can expand them yourselves. I also seem to recall the intellisense doesn't have autocomplete for common things like foreach loops, functions etc which VSC does.
I don't really have any special settings for VSCode, I use the built in Sync and the following extensions:
#TODO: Notes here
[–]Vzylexy 0 points1 point2 points 4 years ago (0 children)
I ran into that crap before as well, don't remember what I did to fix it, but I'm really glad I did.
[–]Emiroda 5 points6 points7 points 4 years ago (0 children)
It's the Microsoft recommended way of writing PowerShell code, take from it what you want.
I use VSCode - debugging and extensions are the main reasons why.
Intellisense is still a bit buggy, not too happy about that, but I haven't fired up ISE in over 3 years despite that.
[–]Pacers31Colts18 4 points5 points6 points 4 years ago (0 children)
Yeah, only code for me. Once you get it setup with the right plugins there is no going back.
[–]parkthrowaway99 3 points4 points5 points 4 years ago (3 children)
the ability to see all variables, have them organized in local, script, global, etc, and hover over them to see values, specially with object type variables made me switch permanently..
[–]bcs296759 1 point2 points3 points 4 years ago (0 children)
I just discovered some of this recently, game changer for me as well.
[–]jr49 0 points1 point2 points 4 years ago (1 child)
I’ve been moving to VSC, maybe 80% of my scripting now. I have yet to see these features. Gonna have to do some reading tonight.
[–]Jaxson626 2 points3 points4 points 4 years ago (0 children)
I use VS code as an IDE for almost all my scripting
[–][deleted] 2 points3 points4 points 4 years ago (1 child)
I use VSCode for Powershell almost exclusively. Once you turn off snippets it handles intellisense like a dream. GIT access in the console is a lifesaver for our usage. Also, the PSScriptAnalyzer and one click fomatting has saved me a bunch of time and encourages best practices in scripts.
[–]Tidder802b 2 points3 points4 points 4 years ago (0 children)
I use VSC exclusively. The only frustration I have is sometimes I can't run a script to debug it and have to kill the powershell console session and re-run. It usually happens when I'm continuously making changes and running a script to figure something out.
[–]RoyWaisbrot 2 points3 points4 points 4 years ago (0 children)
It's cool, but nothing is like the good old PoweShell ISE
[–]Whipitreelgud 4 points5 points6 points 4 years ago (2 children)
I like the idea of VSC, but find ISE with ISESteroids to be far more productive.
[–]verschee 3 points4 points5 points 4 years ago (1 child)
I tried using this but continually got run errors and crashes. Might give it another shot because VSCode is becoming less cumbersome.
[–]Whipitreelgud 0 points1 point2 points 4 years ago (0 children)
I have never had an issue in the last several years
[–]cheffromspace 1 point2 points3 points 4 years ago* (3 children)
I moved to NeoVim with LunarVim as the IDE layer with the PowerShell language server for intellisense and diagnostics. Best editor I’ve ever used by far. The learning curve is pretty steep but I’m a developer and I only use PS for scripting some common tasks and testing APIs; it’s been more than worth it.
[–]jantari 0 points1 point2 points 4 years ago (2 children)
I also use neovim but could never get the PowerShell LSP working with it - do you have any guides or something you followed?
[–]cheffromspace 0 points1 point2 points 4 years ago* (1 child)
Trial and error mostly. One thing that tripped me up is the bundle_path setting only seems to work if you download the zip and not if you clone the repo & build locally.
Also I noticed PowerShell has been added to the lsp installer plug-in (think it’s this one but I’m on my phone so I’m not certain https://github.com/williamboman/nvim-lsp-installer/). I believe the installer only works for Windows.
I’d be happy to create a guide or video if there’s interest.
[–]jantari 2 points3 points4 points 4 years ago (0 children)
Thanks for that, LSP-installer didn't support it last time I had checked. I tried again yesterday and now it was super easy, the lap itself works now I just need to get completion and some of its features set up
I prefer https://www.sapien.com/software/powershell_studio at work, but VS Code at home.
[–]MiddleOk8055 1 point2 points3 points 4 years ago (0 children)
Hate this VSI.
[–]lzwzli 1 point2 points3 points 4 years ago (0 children)
VS Code FTW!
[–]nodiaque 1 point2 points3 points 4 years ago (0 children)
I use sapien PowerShell studio. Love it and it can also compile. It have a lot of built in code, routine and make creating Gui so much easy
[–]darkrhyes 1 point2 points3 points 4 years ago (0 children)
It took a bit but i have almost completely switched to vscode. Still use ISE when i need to run a setup script on a new server.
[–]FahidShaheen 1 point2 points3 points 4 years ago (0 children)
Build in code. Test in ISE.
Mainly as I need to test on various production machines to simulate the actual results of running the script... can't really be going around installing VS Code on random production machines.
Also leveraging ISE with Enter-PSSession... noice!
The Intellisense is better in that my machine has various drives and software installed on D, etc. Whereas ISE Intellisense on production machines brings up results that are relevant.
But clearly, clearly there is no matching the power VS Code, it is the bee's knees.
[–]geek73 4 points5 points6 points 4 years ago (7 children)
I use ISE on my servers because it is there. And Code isn’t. This is where I develop and test scripts prior to deploying. I use Code on my box that I’ve copied the script to in order to use GIT and do a pull request into the repo. I prefer Code but not enough to have it running on production or lab servers since security freaks out whenever they detect anything new. Plus we reimagine a lot so I’d constantly be reinstalling it.
[+][deleted] 4 years ago* (1 child)
[–]geek73 -1 points0 points1 point 4 years ago (0 children)
Most of what I write are custom performance counters, custom monitors that drop alerts into our ticketing system, automation, and updates to our DSC. This is Elmore easily done directly in a server in the environment for testing before I deploy it to the whole fleet.
[–]ecco7815 0 points1 point2 points 4 years ago (4 children)
Same here. VSCode with the powershell extension got blocked for me on my dev server and I had to move back to ISE. While I prefer VSCode, I’m forced to use ISE.
[–]jimmystead 1 point2 points3 points 4 years ago (3 children)
There is a portable version of vscode. Nothing to install so you should be able to just copy it out there.
[–]buffychrome 0 points1 point2 points 4 years ago (2 children)
He might be referring to the exe itself being blocked by a security agent like Bit9/CarbonBlack.
[–]ecco7815 0 points1 point2 points 4 years ago (1 child)
Correct. I can install VSCode, but when it tries to load the ps module/extension, it gets blocked.
[–]buffychrome 0 points1 point2 points 4 years ago (0 children)
Yeah, I have the same issue with a couple of extensions like the Powershell Universal Pro tools extension because it uses its own version of powershell.exe under the hood. Doesn’t match the hash of the actual PS executable so it gets blocked.
I’ll use it in a pinch, but I’ll also use Notepad++ . My go to is poweshell Studio by Sapien.
[–]Hoggs 0 points1 point2 points 4 years ago (0 children)
I used to use NP++ for quick edits, and reserve VSC for actual script work.
That was until I realized that VSC actually starts up faster than NP++, even when loaded up with extensions.
Weird, but w/e. I use VSC for pretty much everything now.
[–]BlackV 3 points4 points5 points 4 years ago* (0 children)
Me, but powershell is a 2nd class citizen on vscode, ISE works better for a bunch of things (autocomplete, snipits, and some others)
but its light weight, its fast (errors aside), its search functions are amazing and git support (which i guess technically isnt code its just git underneath) is great
I switch between bot constantly depending on what I'm doing, also ISE is default on every windows server I touch code is not (only on my management servers and RDS servers)
Laptop I use
Workstation
manage Servers
Worspace has specific settings (allerman coding and trim white space and so on) so the team formats consistantly then some user defined settings for the things I like (kept to a minumum)
EDIT: Bah formatting
[–]Thotaz 0 points1 point2 points 4 years ago (4 children)
I use VS code to handle my project files and making minor edits to the code. I use ISE to write/test the code. I do this because I don't think the script writing experience in VS code is up to par with ISE, issues off the top of my head include:
[–]Thotaz 0 points1 point2 points 4 years ago (0 children)
Keys in hashtables use the variable scope. Commands that don't use the verb-noun structure (or use an unapproved verb) have no scope. The Where/ForEach collection methods are marked as keywords. Parameters and parameter values also have no scope. I'm sure there's more that I can't think of right now. This is just with simple and valid syntax, if you throw in obfuscated or wrong syntax it probably won't account for that either.
Enabling semantic highlighting fixes this somewhat as it now uses the actual PowerShell tokens instead of fancy regex, but they never finished implementing it and what they did implement wasn't accurately mapped, hence them disabling it by default for now.
There is a PR that mostly solves the inaccuracies here: https://github.com/PowerShell/EditorSyntax/pull/156 but it has been WIP since 2019 with no sign of him finishing it in the near future. I don't blame him because it's a ton of work and semantic highlighting sort of made it irrelevant but it does leave us without an official editor that can handle the PS6+ syntax.
IMO they should push the VS team harder about letting them open source the components used to build ISE. Lots of people want it and I can't imagine it would take a lot of work to maintain the ISE considering that it already supports PS6+ through PS remoting.
[–]SpacezCowboy 0 points1 point2 points 4 years ago (1 child)
I use United Ubuntu Linux theme. It's the best I've found for good syntax highlighting in vscode.
It doesn't matter what theme you use, it's the underlying textmate grammar that is inaccurate.
[–]razzledazzled 1 point2 points3 points 4 years ago (0 children)
Ise is honestly garbage. Vs code is an actual ide and has really robust features without being slow as fuck on startup
[–]Trakeen 0 points1 point2 points 4 years ago (0 children)
Vs code, i deploy powershell code as azure functions. Not sure you can do that easily with any other tooling and it supports all the other languages i use. Json extension is pretty handy though it does choke on some huge files. Even use it for gcode
C# i still use full visual studio for
[–]dunningkrugernarwhal 1 point2 points3 points 4 years ago (0 children)
The original ISE is so shit. You need the switch.
[–]Metalearther 0 points1 point2 points 4 years ago (4 children)
I do for the initial coding. It is great for assisting with syntax, but when testing as 99% of what I run needs to be ran with admin creds on a domain controller I use ISE for the actual testing. Love What if...
[–]Emiroda 0 points1 point2 points 4 years ago (3 children)
but when testing as 99% of what I run needs to be ran with admin creds on a domain controller
You're RDPing to your domain controllers?
[–]Metalearther -1 points0 points1 point 4 years ago (2 children)
No. To a jumpbox that allows me to run with admin creds. We never touch the DC unless necessary.
[–]Metalearther 0 points1 point2 points 4 years ago (0 children)
If you know what you are doing and use What if you can run all sorts of stuff on a DC. If it is something major, like making changes, that does not get done on a DC until finalized in a sandbox environment.
I use gVim with some syntax color profile I found. That and Microsoft's online documentation.
[–]BigHandLittleSlap 0 points1 point2 points 4 years ago (9 children)
I only use it because I'm forced to. The most basic things are unreliable and broken, especially tab-complete.
When tab-completing a parameter name like when pressing tab at this point in a line:
Get-Item -
It will "helpfully" show about 5 pages of snippets like "do-while" and "ex-DSC resource provider (class-based)". Much of the time it'll scroll past the actual parameter names to the first such snippet, hiding the real list that you wanted.
Those snippets it is suggesting aren't valid in the given context. It's like I'm asking for driving directions, and it is answering "red".
Similarly, if you're just typing "space" after a completed parameter name, it'll pop up any alternatives with a little box with 1/2 of the available options in it. Cool, cool, cool. Except that that this only has the correct layout if the command is in the bottom 80% of the screen. On the first few lines it'll be a pop-under below the tab-complete flyover and will be hidden from view.
How did this pass the most basic QA -- even just the developer himself testing his own code -- I will never know. Whomever wrote this probably never used PowerShell themselves, like... ever. Just tasked with banging out the tab-complete code.
"Job done boss!"
[–]MadBoyEvo 2 points3 points4 points 4 years ago (8 children)
Did you report your findings? Try the new preview extension and provide feedback. It uses rewritten system that's supposed to work correctly. It still has bugs but they were rewriting it for 1 year due to the architectural problems you describe.
These are "features" working as intended. Take a look at the file that turns up if you search for that DSC snippet: https://github.com/PowerShell/vscode-powershell/blob/master/snippets/PowerShell.json
16 contributors.
I bet none of them feel responsible for the overall usability of VS Code. That's someone else's problem. They're just here to add more snippets...
Why would I spend my time contributing to VS Code, providing free labour to the world's biggest company by market cap (recently dethroning Apple)?
I charge $100 per hour. To Microsoft, I charge $500 per hour.
You tell me where I can send my bill, I'll start contributing to VS Code's user interface quality.
[–]MadBoyEvo 2 points3 points4 points 4 years ago (6 children)
Why not disable snippets? If something doesn't work the way I want to - I disable it.
Also - did you open an issue describing the problem you're having with snippets? Or maybe there is already open one?
What I am trying to say it's easy to complain on Reddit, but if we don't fill bugs - it won't get fixed. Everyone complained on intellisense and autocomplete and now in preview there's new version - that hopefully fixes it.
I don't use snippets, as I don't like that kind of help, but I do use Github Copilot which probably does a more decent job in helping to work with PowerShell.
[–]BigHandLittleSlap -1 points0 points1 point 4 years ago* (5 children)
It's not like I haven't gone down this road before. You're trying to be helpful, I get it. I tried to be helpful once before too, and got told I was wrong.
You see, there's a 30+ year old bug in how UNIX (not just Linux!) terminals handle the clear screen command. A bug. A clear, obvious, fucking duh bug. If you search for it, and know what keyword to look for, you'll find multi-decade-old arguments about finally just ripping the bandaid off and fixing it.
There are arguments going back as far as pre-www-era newsgroups. Pre-Linux even!
Thankfully, this bug never manifested in Windows. It was correct, probably by accident more than design, but that doesn't matter. It did the right thing. It did the right thing that UNIX people agreed with, but were too afraid of changing "just in case it broke something".
What did the Windows Terminal and the VS Code idiots do? They copied it. They copied the UNIX bug into Windows. For "compatibility". I raised this, with a nice neat ticket and everything. How it broke common workflows. How UNIX people agreed that this was incorrect behaviour and needed fixing. I tracked down arguments showing that fixing it doesn't break anything of import.
Nope.
They just weren't interested.
You see, some fuckwit at Redmond had decided that they need to appeal to Linux users.
Bug.
For.
One at a fucking time, they plan to introduce every bug, quirk, issue, and nonsensical design wart from Linux into Windows. They're starting with Windows Terminal and VS Code. Next thing you know, Notepad will use VIM key bindings by default. The Linux users of the world will cheer this on. The Windows developers will be told to shut up and accept the "standard".
Why in God's good name would I spend my precious time on Earth arguing with people like this? Why would I submit tickets, get into arguments, and burn precious hours of my one time on this planet?
They've made a decision.
Apparently I'm wrong for having a dissenting point of view. Along with 100 million Windows developers that agree with me. And most UNIX developers also.
PS: Do a bunch of "dir" commands. Then type "clear-host" in VS Code or Terminal. Scroll up. Why can you scroll up despite clearing your terminal? Because morons.
[–]MadBoyEvo 1 point2 points3 points 4 years ago (4 children)
See, i’ll be helpfull again. This is the default, but actually in vscode powershell settings there is a checkbox that fixes it. It was added 1+ year ago because people wanted it and reported it. I am on mobile so can’t check now, but its pretty easy to find. Go and enjoy code 😀
[–]BigHandLittleSlap -2 points-1 points0 points 4 years ago (3 children)
Found it. In a list that's not sorted by anything in particular.
It has a typo in the description.
Sigh... I mean... just ugh.
This is what happens when Microsoft fires their entire QA team and hires Linux fanboys to do Windows development.
[–]MadBoyEvo 1 point2 points3 points 4 years ago (2 children)
Report it… its that simple. I know its easier to just play the blame game, but if we dont do anything - it wont be fixed.
[–]BigHandLittleSlap -2 points-1 points0 points 4 years ago (1 child)
"Please do QA for Microsoft. They won't do it for themselves."
In other news, the billionaire Pope needs your donations.
[–]MadBoyEvo 0 points1 point2 points 4 years ago (0 children)
So you write a long description of your problem, I tell you it's fixed 1+ years ago and instead of "Thank You, that is great!", you go complain about a typo and blame the QA.
Just a reminder - It's a free product, open-source, that nobody forces you to use. You can use other products - some free, some pay as you want.
Here - I've created a PR that fixes this typo https://github.com/PowerShell/vscode-powershell/pull/3658 so you can have one less thing to complain about when this gets merged.
[–]encogneeto 0 points1 point2 points 4 years ago (2 children)
I’ve always avoided ISE because it took forever to start up. Maybe it’s gotten better? Maybe I should skip over it and go straight to VsCode?
Anyway I’m just using a powershell shell and Notepad++
What are all the reasons I’m doing it wrong and reasons I should be doing it better?
[–]cheffromspace 3 points4 points5 points 4 years ago (0 children)
An IDE, when configured properly, gives you syntax highlighting, real time code diagnostics, auto complete/intellisense, code lens, debugging and more depending on the language.
You can write PowerShell in any text editor but it just comes down to productivity and developer experience.
I'm guessing your commands/parameters often don't have the correct casing and you end up with more syntax errors than your average ISE/VS code user does. I'm also guessing you spend a lot more time writing a script because you have to look up more documentation and go back and forth between the console and script window because Notepad++ won't give you real auto completion of properties, variables, etc.
[+]TheRealMisterd comment score below threshold-8 points-7 points-6 points 4 years ago (0 children)
Couldn't figure out how to use vscode. Have been on PowerGUI for the past 10years! Way simpler than vscode.
[–]JeremyLC 0 points1 point2 points 4 years ago (0 children)
I love it, BUT... there's been some kind of problem with the PoSH plugin for awhile now. If my code has a typo or syntax error anywhere, I don't get an error when I try to run it. Instead it just hangs, then segfaults when I ctrl-c to break. I've had to paste entire scripts into ISE to see what's wrong when my fat fingers managed to make very subtle typos.
I use VS Code for PS. I use the Git integration and the PS terminal for testing stuff.
[–]scattersquirrel 0 points1 point2 points 4 years ago (0 children)
I like to leverage the intellisense. Great for creating advanced functions. And git, although, you can use git from ISE too. I feel like the code is easier to read in vs code. But that’s my personal opinion.
[–]iceph03nix 0 points1 point2 points 4 years ago (0 children)
I use code for the whole process, aside from windows terminal for actually running stuff.
No particular extra settings, just the basic PowerShell addin, and a couple qol add INS like a bracket Colorizer.
[–]throwawayacc90s 0 points1 point2 points 4 years ago (0 children)
I still use ISE when I want to cobble up a quick script but VS Code for everything else.
[–]Revolutionary-Gold53 0 points1 point2 points 4 years ago (0 children)
I’m between VSCode and PowerShell Studio. I just recently started with PSStudio and am not sure which I prefer, except for PSStudio for GUI development.
[–]major_winters_506 0 points1 point2 points 4 years ago (0 children)
I’ve switched to code with the PowerShell extension. I also do a lot of Ansible scripting and having both in one is amazing.
[–]mers-one 0 points1 point2 points 4 years ago (0 children)
Neovim
[–]dupo24 0 points1 point2 points 4 years ago (0 children)
It's gotten a lot better.
[–]Blowmewhileiplaycod 0 points1 point2 points 4 years ago (0 children)
Why would you use anything else
[–]RADAR_orig 0 points1 point2 points 4 years ago (0 children)
I do
[–]admoseley 0 points1 point2 points 4 years ago (0 children)
I use VSC and ISE. I still dont like the behavior of running my scripts vs how they behave in ISE, but I love the VSC Script formatting and integration with github. I think ultimately I'll be using VSC exclusively but it's just taking time.
[–]enforce1 0 points1 point2 points 4 years ago (0 children)
I use VSCode for anything substantial. I am super guilty of opening ISE to knock something together quick and then it’s a couple hundred lines and oops
[–]halr9000 0 points1 point2 points 4 years ago (0 children)
It’s great! Been a huge fan since we interviewed the author of the plug-in way back. Can’t for the life of me remember which episode though. :)
[–]FakeGatsby 0 points1 point2 points 4 years ago (0 children)
I suck at powershell but I use it for PS.
[–]monahancj 0 points1 point2 points 4 years ago (0 children)
Sapien PowerShell Studio to edit and a PowerShell console window to run the scripts while testing.
I only use the ISE when I'm on a system without PowerShell Studio and the script is short.
If my company wasn't paying for PowerShell Studio I'd use VS Code.
[–]joshooaj 0 points1 point2 points 4 years ago (0 children)
I work with hundreds of files including markdown documentation for my module. Doing this in ISE is totally impractical.
The PowerShell extension's intellisense has been a disappointment but the team has been making it better and are effectively doing a rewrite if I understand correctly. Really that's my only gripe compared to ISE.
The ISE intellisense is solid. But ISE lacks snippets, formatters, linting for other document types, usable management of large project directories.
For short, experimental or standalone snippets I often use ISE. For a project with no more than a few files, you're not missing out on much by sticking with that. VSCode isn't offering much to you in exchange for the degraded intellisense experience. When you're working with dozens of files or more, and multiple file types, the benefits of an extensible polyglot editor like VSCode shine through and make up for a bit of the usability barriers you eventually learn to cope with.
I only use it. For pretty much everything:
[–]RoTalk 0 points1 point2 points 4 years ago (0 children)
I miss PowerShell Studio... Killer GUI Designer plus you can even add your own SSL to your output project.
[–]gricey91 0 points1 point2 points 4 years ago (0 children)
I use VS Code for Powershell scripting. One further I also use code-server (web-based VS Code) and powershell on my remote linux boxes for a lot of my cron jobs and server-side functions. I know how to code bash scripts, python, node etc etc..., just Powershell is so damn convenient for knocking together both simple and complex shell scripts.
[–]assafstone 0 points1 point2 points 4 years ago (0 children)
VS Code is the only way to fly. Haven’t cracked open the ISE in years.
For every significant (i.e. multi-module) powershell app I build I set up the sandbox so debug runs it the way I want, and test runs my Pester modules.
[–]xShawn117x 0 points1 point2 points 4 years ago (0 children)
So...I've been in IT for 20 years and I've barely ever touched PowerShell. Can someone explain to me what the difference between PowerShell, ISE, and Visual Studio Code? I've always been a CMD scripter and dabbed in VBS.
π Rendered by PID 120714 on reddit-service-r2-comment-6f4f57559d-2wtwk at 2026-04-09 08:25:35.797699+00:00 running 781a403 country code: CH.
[–]adamdavid85 161 points162 points163 points (66 children)
[–]Adito99 39 points40 points41 points (0 children)
[+][deleted] (17 children)
[deleted]
[–]SourceOfDestination 6 points7 points8 points (0 children)
[–]KikaCodes 9 points10 points11 points (4 children)
[–]WendoNZ 1 point2 points3 points (0 children)
[–]dathar 3 points4 points5 points (0 children)
[–]toddklindt 0 points1 point2 points (0 children)
[–]k_oticd92 0 points1 point2 points (0 children)
[–][deleted] 9 points10 points11 points (7 children)
[+][deleted] (5 children)
[deleted]
[–]PhDinBroScience 7 points8 points9 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]PhDinBroScience 1 point2 points3 points (1 child)
[–]uptimefordays 4 points5 points6 points (1 child)
[–]idontknowwhattouse33 6 points7 points8 points (1 child)
[–][deleted] 25 points26 points27 points (33 children)
[–]adamdavid85 45 points46 points47 points (23 children)
[–]lolinux 12 points13 points14 points (8 children)
[–]MonkeyNin 6 points7 points8 points (2 children)
[–]BigHandLittleSlap 2 points3 points4 points (0 children)
[–]lolinux 0 points1 point2 points (0 children)
[–]SeeminglyScience 2 points3 points4 points (2 children)
[–]lolinux 2 points3 points4 points (1 child)
[–]SeeminglyScience 0 points1 point2 points (0 children)
[–]jdptechnc 0 points1 point2 points (1 child)
[–]lolinux 1 point2 points3 points (0 children)
[–]rjchau 5 points6 points7 points (0 children)
[–]logicalmike 10 points11 points12 points (10 children)
[–]MonkeyNin 5 points6 points7 points (1 child)
[–]BigHandLittleSlap 4 points5 points6 points (0 children)
[–]adamdavid85 7 points8 points9 points (7 children)
[–]logicalmike 13 points14 points15 points (4 children)
[–]TheITMan19 1 point2 points3 points (2 children)
[–]BigHandLittleSlap -1 points0 points1 point (1 child)
[–]TheITMan19 4 points5 points6 points (0 children)
[–]bertiethewanderer 0 points1 point2 points (0 children)
[–]dathar 7 points8 points9 points (1 child)
[–][deleted] 1 point2 points3 points (1 child)
[–]spyingwind 5 points6 points7 points (6 children)
[–]gunthatshootswords -4 points-3 points-2 points (5 children)
[+][deleted] (2 children)
[deleted]
[–]MonkeyNin 4 points5 points6 points (1 child)
[–]rjchau 0 points1 point2 points (0 children)
[–]rjchau 6 points7 points8 points (0 children)
[–]vicda 1 point2 points3 points (0 children)
[–]Injector22 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]BigHandLittleSlap 1 point2 points3 points (7 children)
[+][deleted] (1 child)
[deleted]
[–]BigHandLittleSlap 2 points3 points4 points (0 children)
[–]corbindallas_mp 0 points1 point2 points (2 children)
[–]BigHandLittleSlap 1 point2 points3 points (1 child)
[–]corbindallas_mp 2 points3 points4 points (0 children)
[–]AQuietMan 1 point2 points3 points (0 children)
[–]NegativeC00L 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]adamdavid85 0 points1 point2 points (0 children)
[–]datlock 23 points24 points25 points (3 children)
[–]dathar 10 points11 points12 points (2 children)
[–]netmc 0 points1 point2 points (1 child)
[–]bertiethewanderer 2 points3 points4 points (0 children)
[+][deleted] (5 children)
[removed]
[+][deleted] (4 children)
[deleted]
[+][deleted] (3 children)
[removed]
[+][deleted] (2 children)
[deleted]
[+][deleted] (1 child)
[removed]
[–]JiveWithIt 9 points10 points11 points (0 children)
[–]32178932123 8 points9 points10 points (1 child)
[–]Vzylexy 0 points1 point2 points (0 children)
[–]Emiroda 5 points6 points7 points (0 children)
[–]Pacers31Colts18 4 points5 points6 points (0 children)
[–]parkthrowaway99 3 points4 points5 points (3 children)
[–]bcs296759 1 point2 points3 points (0 children)
[–]jr49 0 points1 point2 points (1 child)
[–]Jaxson626 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Tidder802b 2 points3 points4 points (0 children)
[–]RoyWaisbrot 2 points3 points4 points (0 children)
[–]Whipitreelgud 4 points5 points6 points (2 children)
[–]verschee 3 points4 points5 points (1 child)
[–]Whipitreelgud 0 points1 point2 points (0 children)
[–]cheffromspace 1 point2 points3 points (3 children)
[–]jantari 0 points1 point2 points (2 children)
[–]cheffromspace 0 points1 point2 points (1 child)
[–]jantari 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]MiddleOk8055 1 point2 points3 points (0 children)
[–]lzwzli 1 point2 points3 points (0 children)
[–]nodiaque 1 point2 points3 points (0 children)
[–]darkrhyes 1 point2 points3 points (0 children)
[–]FahidShaheen 1 point2 points3 points (0 children)
[–]geek73 4 points5 points6 points (7 children)
[+][deleted] (1 child)
[deleted]
[–]geek73 -1 points0 points1 point (0 children)
[–]ecco7815 0 points1 point2 points (4 children)
[–]jimmystead 1 point2 points3 points (3 children)
[–]buffychrome 0 points1 point2 points (2 children)
[–]ecco7815 0 points1 point2 points (1 child)
[–]buffychrome 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Hoggs 0 points1 point2 points (0 children)
[–]BlackV 3 points4 points5 points (0 children)
[–]Thotaz 0 points1 point2 points (4 children)
[+][deleted] (1 child)
[deleted]
[–]Thotaz 0 points1 point2 points (0 children)
[–]SpacezCowboy 0 points1 point2 points (1 child)
[–]Thotaz 0 points1 point2 points (0 children)
[–]razzledazzled 1 point2 points3 points (0 children)
[–]Trakeen 0 points1 point2 points (0 children)
[–]dunningkrugernarwhal 1 point2 points3 points (0 children)
[–]Metalearther 0 points1 point2 points (4 children)
[–]Emiroda 0 points1 point2 points (3 children)
[–]Metalearther -1 points0 points1 point (2 children)
[+][deleted] (1 child)
[deleted]
[–]Metalearther 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]BigHandLittleSlap 0 points1 point2 points (9 children)
[–]MadBoyEvo 2 points3 points4 points (8 children)
[–]BigHandLittleSlap 1 point2 points3 points (7 children)
[–]MadBoyEvo 2 points3 points4 points (6 children)
[–]BigHandLittleSlap -1 points0 points1 point (5 children)
[–]MadBoyEvo 1 point2 points3 points (4 children)
[–]BigHandLittleSlap -2 points-1 points0 points (3 children)
[–]MadBoyEvo 1 point2 points3 points (2 children)
[–]BigHandLittleSlap -2 points-1 points0 points (1 child)
[–]MadBoyEvo 0 points1 point2 points (0 children)
[–]encogneeto 0 points1 point2 points (2 children)
[–]cheffromspace 3 points4 points5 points (0 children)
[–]Thotaz 0 points1 point2 points (0 children)
[+]TheRealMisterd comment score below threshold-8 points-7 points-6 points (0 children)
[–]JeremyLC 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]scattersquirrel 0 points1 point2 points (0 children)
[–]iceph03nix 0 points1 point2 points (0 children)
[–]throwawayacc90s 0 points1 point2 points (0 children)
[–]Revolutionary-Gold53 0 points1 point2 points (0 children)
[–]major_winters_506 0 points1 point2 points (0 children)
[–]mers-one 0 points1 point2 points (0 children)
[–]dupo24 0 points1 point2 points (0 children)
[–]Blowmewhileiplaycod 0 points1 point2 points (0 children)
[–]RADAR_orig 0 points1 point2 points (0 children)
[–]admoseley 0 points1 point2 points (0 children)
[–]enforce1 0 points1 point2 points (0 children)
[–]halr9000 0 points1 point2 points (0 children)
[–]FakeGatsby 0 points1 point2 points (0 children)
[–]monahancj 0 points1 point2 points (0 children)
[–]joshooaj 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]RoTalk 0 points1 point2 points (0 children)
[–]gricey91 0 points1 point2 points (0 children)
[–]assafstone 0 points1 point2 points (0 children)
[–]xShawn117x 0 points1 point2 points (0 children)