r/PowerShell • • Oct 31 '21

Who uses Visual Studio Code for PowerShell Scripting?

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?

246 Upvotes

144 comments sorted by

163

u/adamdavid85 Oct 31 '21

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.

40

u/Adito99 Oct 31 '21

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.

8

u/idontknowwhattouse33 Oct 31 '21

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.

28

u/[deleted] Oct 31 '21

Intellisense is far better in ISE

45

u/adamdavid85 Oct 31 '21

I really couldn't disagree more.

14

u/lolinux Oct 31 '21

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

6

u/MonkeyNin Nov 01 '21

intellisense stops working

If that happens, hit f1, type `res, then enter. That'll restart it, without closing the window.

3

u/BigHandLittleSlap Nov 01 '21

That shows all possible things that include the characters "res". For me the prompt has about 150 possibilities in it...

1

u/lolinux Nov 01 '21

Thanks,

I usually would have reloaded the window

3

u/SeeminglyScience Nov 01 '21 edited Nov 01 '21

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.

3

u/lolinux Nov 01 '21

Thank you very much! I will

1

u/SeeminglyScience Nov 01 '21 edited Nov 01 '21

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

1

u/jdptechnc Nov 01 '21

Ctrl + Space (I think) will activate the list of matching commands that you can pick from, if Tab is giving you something dumb.

2

u/lolinux Nov 01 '21

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

6

u/rjchau Nov 01 '21

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.

11

u/logicalmike Oct 31 '21

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.

6

u/MonkeyNin Nov 01 '21

Oh I think I know why there's a different experience,

part 1

Double check that you

  • have the addon installed (not the built in powershell mode)

  • have the debug term / powershell session

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

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

part 2

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.

discord

There's a #vscode channel if you want help with any config, or help, in the powershell server

5

u/BigHandLittleSlap Nov 01 '21

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.

9

u/adamdavid85 Oct 31 '21

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.

14

u/logicalmike Oct 31 '21

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+

2

u/TheITMan19 Oct 31 '21

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.

0

u/BigHandLittleSlap Nov 01 '21

"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."

4

u/TheITMan19 Nov 01 '21

I can’t memorise because my brain is dead you fool. Bloody keyboard warrior

1

u/bertiethewanderer Nov 01 '21

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.

8

u/dathar Oct 31 '21

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.

3

u/[deleted] Oct 31 '21

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.

5

u/spyingwind Oct 31 '21

I just want ForEach-Object to be the default when I type for. Especially after a |.

-2

u/gunthatshootswords Oct 31 '21

What's wrong with %?

7

u/rjchau Nov 01 '21

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.

2

u/vicda Nov 01 '21

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).

0

u/[deleted] Oct 31 '21

[deleted]

5

u/MonkeyNin Nov 01 '21

With the config on, you type

 0..4 | %{ $_ * 2 }

Hit save (or format) and your file now contains

0..4 | ForEach-Object { $_ * 2 }

Config

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.

1

u/rjchau Nov 01 '21

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.

1

u/Injector22 Nov 02 '21

Have you installed the Powershell add-on? Without it, intellisense is pretty bad. Once you install it it's pretty good.

1

u/[deleted] Nov 02 '21

Of course.

2

u/BigHandLittleSlap Oct 31 '21

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.

2

u/AQuietMan Nov 01 '21

The ugly girl thinks any boy that talks to them is Leonardo DiCaprio.

Now I've got to clean tea out of my keyboard. Thanks loads for that.

2

u/NegativeC00L Nov 01 '21

I’ve had scripts fail in VS code that run fine in ISE. I can’t part with my beloved ISE.

1

u/corbindallas_mp Nov 01 '21

Worst off all, the shell regularly locks up or crashes on me. Ctrl-C almost never works.

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.

2

u/BigHandLittleSlap Nov 01 '21

I’m on the latest version.

3

u/corbindallas_mp Nov 01 '21

ĀÆ_(惄)_/ĀÆ 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:

  • temporarily eliminate scripts from your profile

  • using another machine to see if you can repro

  • full uninstall and install

  • combing through the vscode issues on github for similar instances and solutions documented by others

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.

0

u/[deleted] Nov 01 '21

[deleted]

4

u/BigHandLittleSlap Nov 01 '21

I’m literally only using VS Code to do cloud deployments.

I like the cloud.

0

u/[deleted] Oct 31 '21

[deleted]

7

u/SourceOfDestination Oct 31 '21

There's a portable version available as well. No installation needed.

11

u/KikaCodes Oct 31 '21

FYI as of very recently there's a web based VS Code that doesn't need installing.

4

u/dathar Oct 31 '21

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

1

u/toddklindt Oct 31 '21

The web version of VS Code didn't support the PowerShell extension the last time I looked.

1

u/k_oticd92 Nov 01 '21

If you're in one of your github repos, you can press "." to launch a web-based VSCode in that folder...pretty dope

10

u/[deleted] Oct 31 '21

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?

0

u/[deleted] Oct 31 '21

[deleted]

8

u/PhDinBroScience Oct 31 '21

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.

0

u/[deleted] Nov 01 '21

[deleted]

2

u/PhDinBroScience Nov 01 '21

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.

5

u/uptimefordays Nov 01 '21

Why script on the server when you can do it on your machine and use PSRemoting?

0

u/[deleted] Nov 21 '21

[deleted]

1

u/adamdavid85 Nov 21 '21

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.

24

u/datlock Oct 31 '21

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.

10

u/dathar Oct 31 '21

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.

1

u/netmc Oct 31 '21

I will have to check these out.

3

u/bertiethewanderer Nov 01 '21

Might also like BracketColorizer2, for me this is a god send.

10

u/JiveWithIt Oct 31 '21

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

10

u/32178932123 Oct 31 '21

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:

  • Powershell (obviously!)

  • Git History (helpful to see a visual idea of your git repository)

  • Todo Tree (you can type #TODO: Notes here and it'll put it in your Todo Tree list so you can go back to things)

  • Rainbow Brackets (colour codes brackets for easier reading)

  • Indent Rainbow (makes a tab indent shaded for easier tracking).

1

u/Vzylexy Oct 31 '21

I ran into that crap before as well, don't remember what I did to fix it, but I'm really glad I did.

7

u/Emiroda Oct 31 '21

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.

5

u/Pacers31Colts18 Oct 31 '21

Yeah, only code for me. Once you get it setup with the right plugins there is no going back.

4

u/parkthrowaway99 Oct 31 '21

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..

2

u/bcs296759 Oct 31 '21

I just discovered some of this recently, game changer for me as well.

1

u/jr49 Oct 31 '21

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.

4

u/Jaxson626 Oct 31 '21

I use VS code as an IDE for almost all my scripting

3

u/[deleted] Oct 31 '21

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.

3

u/Tidder802b Oct 31 '21

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.

3

u/RoyWaisbrot Oct 31 '21

It's cool, but nothing is like the good old PoweShell ISE

6

u/Whipitreelgud Oct 31 '21

I like the idea of VSC, but find ISE with ISESteroids to be far more productive.

4

u/verschee Oct 31 '21

I tried using this but continually got run errors and crashes. Might give it another shot because VSCode is becoming less cumbersome.

1

u/Whipitreelgud Oct 31 '21

I have never had an issue in the last several years

2

u/cheffromspace Oct 31 '21 edited Oct 31 '21

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.

1

u/jantari Oct 31 '21

I also use neovim but could never get the PowerShell LSP working with it - do you have any guides or something you followed?

1

u/cheffromspace Oct 31 '21 edited Oct 31 '21

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.

3

u/jantari Nov 01 '21

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

2

u/[deleted] Oct 31 '21

I prefer https://www.sapien.com/software/powershell_studio at work, but VS Code at home.

2

u/MiddleOk8055 Oct 31 '21

Hate this VSI.

2

u/lzwzli Oct 31 '21

VS Code FTW!

2

u/nodiaque Oct 31 '21

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

2

u/darkrhyes Nov 01 '21

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.

2

u/FahidShaheen Nov 01 '21

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.

5

u/geek73 Oct 31 '21

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.

1

u/ecco7815 Nov 01 '21

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.

2

u/jimmystead Nov 01 '21

There is a portable version of vscode. Nothing to install so you should be able to just copy it out there.

1

u/buffychrome Nov 01 '21

He might be referring to the exe itself being blocked by a security agent like Bit9/CarbonBlack.

1

u/ecco7815 Nov 01 '21

Correct. I can install VSCode, but when it tries to load the ps module/extension, it gets blocked.

1

u/buffychrome Nov 01 '21

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.

0

u/[deleted] Oct 31 '21

[deleted]

0

u/geek73 Nov 01 '21

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.

3

u/[deleted] Oct 31 '21

I’ll use it in a pinch, but I’ll also use Notepad++ . My go to is poweshell Studio by Sapien.

1

u/Hoggs Nov 01 '21

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.

3

u/BlackV Oct 31 '21 edited Oct 31 '21

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

  • code insiders

  • powershell preview plugin

  • git lens plugin

  • XML Toos

  • Markdown lint

Workstation

  • code

  • powershell plugin

  • git lens plugin

  • XML Toos

  • Markdown lint

  • Inline Values support for powershell (enables in-line values on variables when debugging powershell)

manage Servers

  • VSCode

  • Powershell plugin

  • git lens

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

2

u/Thotaz Oct 31 '21

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:

  • Inaccurate syntax highlighting

  • Code ran with F8 is added to the history

  • Confusing multi cursors instead of the more traditional column selection with virtual space

  • Linebreaks aren't shown in the tooltip window so it's hard to use .NET methods because the overloads aren't shown properly.

1

u/SpacezCowboy Nov 01 '21

I use United Ubuntu Linux theme. It's the best I've found for good syntax highlighting in vscode.

1

u/Thotaz Nov 01 '21

It doesn't matter what theme you use, it's the underlying textmate grammar that is inaccurate.

0

u/[deleted] Oct 31 '21

[deleted]

1

u/Thotaz Oct 31 '21

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.

2

u/razzledazzled Oct 31 '21

Ise is honestly garbage. Vs code is an actual ide and has really robust features without being slow as fuck on startup

1

u/Trakeen Oct 31 '21

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

1

u/JeremyLC Oct 31 '21

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.

1

u/[deleted] Oct 31 '21

I use VS Code for PS. I use the Git integration and the PS terminal for testing stuff.

1

u/scattersquirrel Oct 31 '21

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.

1

u/iceph03nix Oct 31 '21

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.

1

u/throwawayacc90s Oct 31 '21

I still use ISE when I want to cobble up a quick script but VS Code for everything else.

1

u/Revolutionary-Gold53 Oct 31 '21

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.

1

u/major_winters_506 Oct 31 '21

I’ve switched to code with the PowerShell extension. I also do a lot of Ansible scripting and having both in one is amazing.

1

u/dupo24 Oct 31 '21

It's gotten a lot better.

1

u/Blowmewhileiplaycod Oct 31 '21

Why would you use anything else

1

u/admoseley Nov 01 '21

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.

1

u/enforce1 Nov 01 '21

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

1

u/halr9000 Nov 01 '21

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. :)

1

u/FakeGatsby Nov 01 '21

I suck at powershell but I use it for PS.

1

u/monahancj Nov 01 '21

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.

1

u/joshooaj Nov 01 '21

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.

1

u/[deleted] Nov 01 '21

I only use it. For pretty much everything:

1

u/RoTalk Nov 01 '21

I miss PowerShell Studio... Killer GUI Designer plus you can even add your own SSL to your output project.

1

u/gricey91 Nov 14 '21

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.

1

u/assafstone Nov 20 '21

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.

1

u/xShawn117x Nov 23 '21

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.

1

u/dunningkrugernarwhal Oct 31 '21

The original ISE is so shit. You need the switch.

1

u/Metalearther Oct 31 '21

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...

1

u/Emiroda Oct 31 '21

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?

0

u/Metalearther Oct 31 '21

No. To a jumpbox that allows me to run with admin creds. We never touch the DC unless necessary.

0

u/[deleted] Nov 01 '21

[deleted]

1

u/Metalearther Nov 01 '21

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.

1

u/[deleted] Oct 31 '21

I use gVim with some syntax color profile I found. That and Microsoft's online documentation.

1

u/BigHandLittleSlap Nov 01 '21

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!"

3

u/MadBoyEvo Nov 01 '21

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.

2

u/BigHandLittleSlap Nov 01 '21

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.

3

u/MadBoyEvo Nov 01 '21

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.

0

u/BigHandLittleSlap Nov 01 '21 edited Nov 01 '21

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.

Bug.

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.

2

u/MadBoyEvo Nov 01 '21

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 šŸ˜€

-1

u/BigHandLittleSlap Nov 01 '21

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.

2

u/MadBoyEvo Nov 01 '21

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.

-1

u/BigHandLittleSlap Nov 01 '21

"Please do QA for Microsoft. They won't do it for themselves."

In other news, the billionaire Pope needs your donations.

1

u/MadBoyEvo Nov 01 '21

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.

0

u/encogneeto Oct 31 '21

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?

3

u/cheffromspace Oct 31 '21

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.

1

u/Thotaz Oct 31 '21

What are all the reasons I’m doing it wrong and reasons I should be doing it better?

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.

-7

u/TheRealMisterd Oct 31 '21

Couldn't figure out how to use vscode. Have been on PowerGUI for the past 10years! Way simpler than vscode.