Intellisense for PowerShell
Not mine, I asked to publish a person who does not have an accre on the hub, but did not dare to entrust the creation to the sandbox.
Many people are unhappy that PowerShell scripts are very difficult to write due to the specific names of the cmdlets and that the scripting environment itself is not very convenient. Part of the problem is solved by the availability of a fairly convenient Windows PowerShell ISE, it is possible to execute individual commands in it, as well as write scripts and debug them right there. ISE also supports working with tabs, it is possible to transform the interface for yourself: adjust the layout of panels, change the font, etc. In ISE it is also very convenient to manipulate the code, easily highlighting, deleting, copying its various parts using the usual key combinations. There is also a powerful scripting tool - PowerGUIfrom Quest Software Inc. but it is more intended for professional use.
But what about lovers of black windows? After all, the supplied PowerShell console application, although it has slightly more features than cmd, is not always possible to enjoy working in it. Console PowerShell can prompt file paths, cmdlets, and their parameters. But admit, it would be nice to have your IntelliSence for PowerShell, isn't it? Here is a supplement to PS I want to talk about. Most likely, people who often write scripts on PS have long known and use this extension, but at least not a word about it in the Habr, or was I looking badly?
So the name of this add-on is PowerTab (I apologize in advance if you knew about this add-on and often used it and this post provides you with useless information). You can take it from this site ,link to the download page . At the moment, there are versions available for 1 pro-shell, as well as for spring 2.0, which is present in Windows 7 and Windows Server R2 and can be downloaded from the Microsoft website.
What can this my favorite PowerTab do? And he knows how much: to prompt file paths, variable names, object methods, cmdlets - and all this is just like in Visual Studio. This is such a cool thing that it can replace almost the entire help for you. Using PowerTab, I discovered a lot of interesting things and I hope it helps you too.
Download the archive from here and unpack it to any folder. Installation must be done with administrator privileges, by running the Setup.Cmd file. PowerTab installs pretty quickly, all questions can be answered Yes. By default, the settings are saved in the Documents \ WindowsPowerShell folder, and if your existing settings file already existed, then all information is added to the end of the Microsoft.PowerShell_profile.ps1 file, which in PS is named $ PROFILE.
Immediately after installation, you can begin to work. Try typing set- / get- and press Tab and you will see the desired IntelliSence. As I said, PowerTab can prompt file paths, cmdlets, and their parameters.
PT helps a lot when working with .net classes, for example, if we want to call MessageBox, PowerTab will save us from typing a long construct like [System.Console] :: WriteLine (“Hello, Habrahabr”)
PT can also be perfectly ponalized. All PowerTab settings are stored in the $ PowerTabConfig object. For example, you can load ready-made themes for PT with the command $ powertabconfig.Colors.ImportTheme ((import-csv ~ \ Desktop \ PowerTab99b2-fixed \ PowerTab \ ThemeDragon.csv))
To see all the hints, you can immediately type% and press Tab, also the% symbol is used to supplement the commands, for example, to not write Invoke-, you can type in% and press Tab.
In addition to the possibilities of working with .net classes, I will mention the following features. To see all the constructors of the class, you can type something like ["class name .net without quotes"] and put one colon and press Tab. And if you type ["the name of the class .net without quotes"] = and press the mighty Tab, the string is converted to the next New-Object "class name .net without quotes."
When working with WMI, PowerTab simply simplifies the task tremendously. Try Get-WmiObject Win32_ + tab, all classes are in full view.
Well, the last useful thing about which I would like to say that to force PT to replace aliases with their standard names, you need to run the command $ powertabconfig.AliasQuickExpand = $ true.
UPD There may be problems at startup due to script execution policies. It should be changed from "do not run scripts" to "run your own and / or signed ones". Thanks to habruiser lostmsu
UPD2 The policy is set by the script Set-ExecutionPolicy -ExecutionPolicy remotesigned - thanks to the author of the article
Many people are unhappy that PowerShell scripts are very difficult to write due to the specific names of the cmdlets and that the scripting environment itself is not very convenient. Part of the problem is solved by the availability of a fairly convenient Windows PowerShell ISE, it is possible to execute individual commands in it, as well as write scripts and debug them right there. ISE also supports working with tabs, it is possible to transform the interface for yourself: adjust the layout of panels, change the font, etc. In ISE it is also very convenient to manipulate the code, easily highlighting, deleting, copying its various parts using the usual key combinations. There is also a powerful scripting tool - PowerGUIfrom Quest Software Inc. but it is more intended for professional use.
But what about lovers of black windows? After all, the supplied PowerShell console application, although it has slightly more features than cmd, is not always possible to enjoy working in it. Console PowerShell can prompt file paths, cmdlets, and their parameters. But admit, it would be nice to have your IntelliSence for PowerShell, isn't it? Here is a supplement to PS I want to talk about. Most likely, people who often write scripts on PS have long known and use this extension, but at least not a word about it in the Habr, or was I looking badly?
So the name of this add-on is PowerTab (I apologize in advance if you knew about this add-on and often used it and this post provides you with useless information). You can take it from this site ,link to the download page . At the moment, there are versions available for 1 pro-shell, as well as for spring 2.0, which is present in Windows 7 and Windows Server R2 and can be downloaded from the Microsoft website.
What can this my favorite PowerTab do? And he knows how much: to prompt file paths, variable names, object methods, cmdlets - and all this is just like in Visual Studio. This is such a cool thing that it can replace almost the entire help for you. Using PowerTab, I discovered a lot of interesting things and I hope it helps you too.
Installation
Download the archive from here and unpack it to any folder. Installation must be done with administrator privileges, by running the Setup.Cmd file. PowerTab installs pretty quickly, all questions can be answered Yes. By default, the settings are saved in the Documents \ WindowsPowerShell folder, and if your existing settings file already existed, then all information is added to the end of the Microsoft.PowerShell_profile.ps1 file, which in PS is named $ PROFILE.
Examples of using
Immediately after installation, you can begin to work. Try typing set- / get- and press Tab and you will see the desired IntelliSence. As I said, PowerTab can prompt file paths, cmdlets, and their parameters.
PT helps a lot when working with .net classes, for example, if we want to call MessageBox, PowerTab will save us from typing a long construct like [System.Console] :: WriteLine (“Hello, Habrahabr”)
PT can also be perfectly ponalized. All PowerTab settings are stored in the $ PowerTabConfig object. For example, you can load ready-made themes for PT with the command $ powertabconfig.Colors.ImportTheme ((import-csv ~ \ Desktop \ PowerTab99b2-fixed \ PowerTab \ ThemeDragon.csv))
To see all the hints, you can immediately type% and press Tab, also the% symbol is used to supplement the commands, for example, to not write Invoke-, you can type in% and press Tab.
In addition to the possibilities of working with .net classes, I will mention the following features. To see all the constructors of the class, you can type something like ["class name .net without quotes"] and put one colon and press Tab. And if you type ["the name of the class .net without quotes"] = and press the mighty Tab, the string is converted to the next New-Object "class name .net without quotes."
When working with WMI, PowerTab simply simplifies the task tremendously. Try Get-WmiObject Win32_ + tab, all classes are in full view.
Well, the last useful thing about which I would like to say that to force PT to replace aliases with their standard names, you need to run the command $ powertabconfig.AliasQuickExpand = $ true.
UPD There may be problems at startup due to script execution policies. It should be changed from "do not run scripts" to "run your own and / or signed ones". Thanks to habruiser lostmsu
UPD2 The policy is set by the script Set-ExecutionPolicy -ExecutionPolicy remotesigned - thanks to the author of the article