Can I get intellisense in powershell? - powershell

Edit: Anyone coming to the question now. Please look at the dates. This is a very, very, old question from the first version of PowerShell. Everything is now different
Just starting out with PowerShell, I would love to have intellisense support for writing PowerShell scripts. Tab-completion works great so you would think it would exist somewhere, but the only thing I can find an article from 2007 - hardly up to date.
Is there an extension somewhere that gives you this ability?
How about an editor?

Try this -
http://powergui.org/index.jspa
This is a good editor with intellisense

The Windows PowerShell ISE which is installed with later versions of PowerShell has got built-in intellisense.
Also Visual Studio Code with the PowerShell extension is another option
And ISE Steroids if you want to stay with ISE
But seems direction is VS Code, especially with Core

Have a look on PowerTab.

Also PowerShell Plus (commercial). Or you can wait for PowerShell 2.0 and hopefully get Graphical Windows PowerShell.

PowerSE is a free PowerShell Editor that includes Intellisense (PowerShell, WMI, and .NET)
Features:
Includes Auto-Script creation feature - execute a cmdlet, look at the results in a grid view, select and sort columns, then tell it to generate the PowerShell for you.
Community button to search TechNet and PoshCode for samples.
Debug features such as breakpoints and stepping through code.
Watch window to drill into PowerShell variables.
Context sensitive help.
Imbedded console window with command recorder.

Try visual studio code with powershell extension. It works better than Windows PowerShell ISE for me.

PSReadline now has intellisense right in the console based on the command history. https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/
To enable in powershell 7:
Set-PSReadLineOption -PredictionSource History
You can also get that version of psreadline in powershell 5.1.
Install-Module PSReadLine -RequiredVersion 2.1.0

I think it is the best way that you write TabExpansion.
There are no Autocomplteion tools for posh, like C#'s IntelliSence.
They can't get even $_'s properties even if you use just a standard Cmdlet.

PowerShell ISE v3 has Intellisense
http://www.microsoft.com/download/en/details.aspx?id=27548

Related

Visual Studio 2019 Developer PowerShell v16.9.4 not working

I have an issue or question with regards to Visual Studio 2019 Developer PowerShell v16.9.4.
I have Visual Studio Professional 2019, Version 16.9.4.
When I right click on my Solution and select Open in Terminal then Visual Studio 2019 Developer PowerShell v16.9.4 opens... but it doesn't allow me to put/execute any command son it.
My impression is that it's not fully loaded or something...
By contrast if I open Visual Studio 2019 Developer Command Prompt as you can see from the image bellow: v16.9.4 I'm able to execute commands on it.
And this is what happens with the PowerShell
Note: I know there's the settings options but I haven't modified anything yet there.
Am I missing somthing or someone else could point me in the right direction to make it work?
I have solved or found a workaround.
In my initial post, I did mention that I knew that there was a settings option but I haven't done anything there ... yet.
Finally, I solved going in that direction.
So, just in case someone else faces the same or similar situation.
My built-in Developer PowerShell (inside Visual studio) is configured as follows:
shell location: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -NoExit -Command "& { Import-Module $env:VSAPPIDDIR\..\Tools\Microsoft.VisualStudio.DevShell.dll}; Enter-VsDevShell -SkipAutomaticLocation -SetDefaultWindowTitle -InstallPath $env:VSAPPIDDIR\..\..\
So, I created a new Developer PowerShell settings called: "Sebas PowerShell" (quite original 🤣) and with the following settings (fewer arguments):
shell location: same location pointing to powershell.exe
Arguments: -NoExit
Like this, it works perfectly fine.
So, I guess it might be related to DevShell.dll or to the other arguments.
In any case, now I can use the Developer PowerShell inside Visual Studio 😀
I know this is a bit late, but I have found that if you have a project selected in Solution Explorer and then choose Open In Terminal, it works fine. If you have any other node selected, the Powershell window opens, but you can't type anything.
No need to create new settings.
Makes sense I suppose, as the point of the terminal is to run commands related to a specific project.
Hope that helps.

Powershell ISE variable highlighter

Is there any add-ons for Powershell ISE where you can highlight any occurrence of the variable or any word? Something like Sublime Text has?
The ISE doesn't have support for add-ons, but Visual Studio Code does (and there's lots of good ones). It also has much better built-in syntax highlighting and Git support (if Git is installed). You'll need to install the PowerShell extension from the "extension marketplace" (just search for "PowerShell"). Also, Microsoft has said that they're not planning to continue maintenance of ISE, so VS Code is probably what you should be using to write PowerShell.
The ISE was not highlighting any keywords/syntaxes, for me the issue was with the file extension, the PS script file extension was inadvertently set to .ps, when I renamed it to have .ps1 extension, all the syntax highlighting revived. Hope this helps others.

Using Powershell ISE's intellisense in other terminal

I'm a big fan of powershell ISE as a terminal. It has intellisense and syntax highlighting built in the shell and I just use it instead of the regular shell for everyday commands.
I would like to use Visual Studio Code instead, because the editor is much more powerfull and has support for a whole lot of languages and format. However the integrated shell is you basic Powershell terminal : no intellisense, no coloring (even with Powershell 5 installed on my computer).
Is there any way to add intellisense and coloring to my terminal, or use ISE's terminal in VSCode? or is there a plugin somewhere adressing these issues?
The integrated PowerShell terminal on Visual Studio Code does have intellisense, so I'm unclear what you require here, are you sure it's not set to cmd.exe instead ?
On another note, follow this setup guide. In case you haven't already installed the PowerShell Extension.

How to make input into powershell colored?

I've programmed in the past and I remember having a terminal that would change the colors of words depending on their function (different color for variables, different color if I imported something etc). How is this accomplished in general? I installed Pygments but it seems that just does it for text files.
Any help would be greatly appreciated
Powershell ISE with Powershell Version 4.0+ Includes some good coloring features for interactive scripting.
Powershell v2 ships with Windows 7, v4 can be downloaded and ISE is on the machine already. Current powershell version is v5, but beware-- some software like Server 2008 R2 running Exchange 2010 is built on v2, and a lot of the cmdlets won't work for v3-v5 without PS-Sessions.
In case you were curious about coloring output to the host, you can just do
Write-Host "my string" -fore 'color' -back 'color'
If you want a fully-fledged powershell IDE, you can purchase SAPIEN Powershell Studio which also wraps scripts in Windows Forms, can build MSI packages and similar things. If you're a hard core powershell kind of guy, it may be worth your time if making GUI powershell applications.

What free Powershell editors can I use on Windows XP SP2?

I have Windows 7 at home with Powershell 2 and I really like the free version of the PowerGUI Powershell editor.
I'd like to start using Powershell at work but we are on version 1.o on XP with SP2. I was going to install PowerGui but
it looks like it requires some Core components or maybe even Powershell 2.0. I expect that our XP production servers may not have this version and I think it is safe to stay with 1.0 for now to avoid pushback from the keys with the keys to the production box.
My question is this:
Is there an editor like powerGui that I can use with version 1 where I do not have to install additional Powershell components that may not be present in production?
You can use all of the free and commercial editors on XP:
PowerShell Integrated Scripting Environment (ISE) ships with PowerShell V2
PowerGUI (www.powergui.org) is a great free editor with support for code folding and intellisense, and PowerPacks to make it easy to work with PowerShell by point and click
Idera makes another great editor (PowerShell Plus - www.powershellplus.com) with a strong collection of scripts that ship with it.
DevFarm makes PowerWF and PowerSE (www.powerwf.com), and editor and workflow tool for working with PowerShell
PrimalForms is an editor and tool to make UI in PowerShell, built by Sapien (www.sapien.com)
Hope this Helps
If your question is actual PowerGUI script editor (version 2.4.0) works with PowerShell V1.0. My answer is that I don't think it works. In my understanding you need a version before 2.0 . I'am using PowerGUI 1.9.5.966 which works perfectly with PowerShel V1.0.