PowerShell Tools for Visual Studio 2013

Free

PowerShell integration for Visual Studio

(36) Review
Visual Studio
2013
Download (73,482)
7/24/2014
1.0.0
View
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (36)
Q and A (54)
Sign in to write a review
Sort by:

by Gemini Kris | June 27 2014

Amazing, simply works!

by Matthew Reynolds [MSFT] | June 26 2014

Thank you thank you thank you. Lately I find myself working on mixed C# / Powershell script projects, and being able to do everything directly in VS is awesome.

by Anthony Caragol | June 18 2014

Very nice, love to have this as an option!

by Ryan Mann (TLC) | May 09 2014

This tool works great, but you are running the powershell runspace in the AppDomain.

This causes issues for me because I am developing a powershell module and testing it in the IDE with a script.

So I right click the script and click execute, and it works great. But then I can build my powershell module because Visual Studio has the dll open still because the dll wasn't unloaded at the end of the script.

I suggest that you Create a separate app domain for the script to run in and when it's done (error and all) unload it.

Edit:

Why don't you just have the executor run in a console app and use ProcessStartInfo to run it hidden and get it's output to write to the VS output window? You could compile the console app for x64 and x32 and make the right click execute script have two options "Execute 32" or "Execute 64"

Adam R Driscoll June 03 2014
| Edit |
Delete

This is actually a problem for me as well. :) The problem is with debugging. I need to have access to the variables, breakpoints and debugger state. My hope is to take advantage of the new remote debugging to work around this issue. It's certainly on my radar.

by Matt Wrock | April 21 2014

Awesome extension. Great work here!

by Ivan_Shakhov | April 14 2014

Excellent tool.
However
1. After long time I have found "execute as script", I was definitely expecting it in the SolutionExplorer. It lacks asking for mandatory parameters.
2. There is a project structure, but no intellisense for calling one script form another, like
& "$ProductHomeDir\PowerOff.ps1" -cloneNamePattern $cloneNamePattern

Adam R Driscoll June 03 2014
| Edit |
Delete

I love those ideas! Could you post them on GitHub??

by Guido Basilio de Oliveira | April 04 2014

Exelent Tool, you should keep up the developmemnt

by Kurt Congdon | April 03 2014

Very cool! Keep up the great work

by Lee Berg | March 21 2014

Five out of Five.

Our team is using TFS to manage PowerShell scripts we use in our various projects. Being able to work with scripts directly in Visual Studio and interact with TFS is a great workflow!

Adam R Driscoll March 29 2014
| Edit |
Delete

Thanks, Lee!

by Rob Plank | March 13 2014

by bgoldsht | February 24 2014

Adam,
looks like you forgot to include VS2013 as a target in 0.7.2
I am getting [ERROR] Resolve-Path : Cannot find path 'C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\&' because it does not exist. I have only VS2013 installed.

After downgrade to 0.7.1 all works again.

Thanks.

Adam R Driscoll March 23 2014
| Edit |
Delete

Dang. Will have to look into that.

by Matt Watt | February 24 2014

0.7.2 throws an exception in VS 2013 Ultimate. Win7 x64

"SetSite failed for package [PowerShellToolsPackage]"
"Exception has been thrown by the target of an invocation."

by John Ludlow | February 21 2014

Good stuff!

Some suggestions which I think could make it better: Make intellisense work
more like Visual Studio (ctrl-space rather than tab)), and add options for
generating help and tests for modules and functions.

But otherwise, great! :)

by Adrian Faciu | February 13 2014

by wonderblast1 | January 27 2014

by Fakher Halim | January 25 2014

I was dying to see some tool like this.
We guys spend almost 8 hours a day in front of Visual Studio, yet to do PowerShell, we had to move out of it,
and click other third party Tools (or ISE). What a distraction!

I wish they do a little more to support this forgotten area of serious developer tools development.

by Alexander Romanov | January 14 2014

by Matthias Einig [MVP] | January 09 2014

Awesome work! Thanks!

by sluggie | December 13 2013

This tool is great! I can stay in Visual Studio and not have to switch out to another tool for PowerShell

by BI Admin (Bryant E. Byrd) | December 12 2013

This is a fantastic tool. It's important for me to be able to keep my PowerShell scripts in a common solution with my other projects. This makes it easier to do that since the editor is now integrated right in VS.

Thank you!

1 - 20 of 36 Items   
Sign in to start a discussion


  • Project properties went away
    3 Posts | Last post Mon 11:31 PM
    • Awesome toolset, Adam! Thanks so much for all of the work you have put into it: my team uses it a lot. We just upgraded to 0.8.0, and the new debug shell looks like a really useful addition.
      
      One issue I noticed right away, though: there used to be an extra settings tab on the project properties. We made heavy use of this to put properties into the project file, and then later during build auto-generate a .psd1 manifest file.
      
      Since upgrading to PoshTools 0.8.0, that tab doesn't show up, even for .pssproj files newly created by the plugin.
      
      Was this purposely removed? If so, is there a new/different plan/solution for managing manifest files?
    • Thanks! I had removed it because it really wasn't hooked up to anything but you make a really good use-case there. I hadn't thought of that at all. I'll add it back in the next version! I had envisioned that the manifest would automatically be generated with MSBuild tasks but that hasn't been done but since the properties are stored in the psproj, I guess that does make the page useful. 
      
      
    • Just installed the 1.0 toolset and found the module properties are back! Thank-you! Haven't really put the new version through it's paces yet, but things look good so far.
  • Common exported functions not being found in extension, but works fine in PowerGUI and PowerShell ISE
    4 Posts | Last post July 25, 2014
    • First things first. My hats off to you Adam Driscoll. Nice work. I'm going to be sending you a donation (in fact for how quick Adam responds to issues on a free project, everybody here should donate at least $10 :). 
      
      So. I'm having an issue with a project loading a module correctly. I've got a fresh install of VS 2013 Ultimate and have the latest PowerGUI installed. In PowerGUI if I run the following code:
      
      # Code Start
      Import-Module SMLETS
      $rootEnum = Get-SCSMEnumeration -ComputerName XXXXXXXX IncidentClassificationEnum$
      
      $destEnumId = (get-scsmchildenumeration -ComputerName XXXXXXXX -Enumeration $rootEnum | ? { $_.DisplayName -like '*Request Services*' }).id
      $class = Get-SCSMClass -ComputerName XXXXXXXX -Name System.WorkItem.Incident
      
      $b = Get-SCSMClassInstance  -ComputerName XXXXXXXX -class $class -filter "Id -eq IR33333"
      
      # Code End
      
      In PowerGUI on the same PC (Windows 7 Ent), that above code runs fine. It also runs perfectly in PowerShell ISE. The weird part is that SMLETS are being loaded because the Get-SCSMClass module call doesn't bomb and the $destEnumID and $class are being populated with appropriate guids.
      
      When I run this in my VS2013 ULT IDE, when I attempt to run the Get-SCSMClassInstance call, I get the following error:
      
      Get-SCSMClassInstance : The term 'Get-SCSMClassInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At C:\XXXXXXXX\ClassificationUpdate.ps1:8 char:8
       +     $b = Get-SCSMClassInstance  -ComputerName XXXXXXXX -class $class -filter "Id -eq IR33333"
           + CategoryInfo          : ObjectNotFound: (Get-SCSMClassInstance:String) [], CommandNotFoundException
           + FullyQualifiedErrorId : CommandNotFoundException  
      
      I'm lost on this issue. Any advice would be appreciated. Since I work mostly in VS2013 I would love to use your product there.
      
      Thank you,
      
      Patrick
    • Thanks!! Glad you're digging it. 
      
      When you run "Get-Command -Module 'SMLETS'" in VS what's returned? I can grab that module later and give it a shot. I don't believe there is anything that should prevent this from working. The only thing I could think of is if the module is x64 only, you may have a problem because VS only supports x86. 
    • I am running the x86 version currently. I've traced that specific CMDLET and found out that it is actually part of the System.Center.Service.Manager.psd1 and specifically included: import-module -name 'C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\System.Center.Service.Manager.psd1'
      
      Now that works. The question is, how come when I run this from PowerShell ISE or PowerGUI, this specific import is not required? 
      
      Also, starting a trend I hope. Everyone in this thread -- $10 :)  (ref#:3S755538FV140163V)
    • I like this trend. Thank you so much! :D
      
      Not sure why that is required. I can't imagine there being anything too special about the PowerShell host in VS. I will have to do some debugging. 
  • Folders not working under PowerShell project in VS2013 Update1 and 2
    2 Posts | Last post July 07, 2014
    • Hi, I need to add folders to get some order in my PowerShell but after I added a folder to the PowerShell Project in Visual Studio 2013 if I do right-click in that folder the Visual Studio instance gets frozen and I had to close Visual Studio and start again.
      Are you going to fix this issue in the future? I'm being prevented to use this super usefull tool for this "silly" bug.
      Thanks,
      Guillermo Bas
    • I'm unable to repro this. Could you open an issue on GitHub and throw some more information about your machine\configuration on there? 
  • Getting Restricted Script Error
    3 Posts | Last post July 07, 2014
    • I'm getting the following errors...
      
      [ERROR] . : File XXXXXXXXXX cannot be loaded because running scripts is disabled on this system. For more information, 
      [ERROR] see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
      [ERROR] At line:1 char:3
      [ERROR] + . 'D:\xxxx\xxxx\'
      [ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      [ERROR]     + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      [ERROR]     + FullyQualifiedErrorId : UnauthorizedAccess
      
      
      When i load power shell separately it shows me as having the execution policy set to unrestricted... maybe i'm thinking it's the wrong thing here any help is appreciated :) your addon looks amazing i've been looking for IDE tools for Powershell frustrated that MS doesn't have anything in VS already lol then i found your thing today.
    • Sorted this out myself!
      seems that the prompt's run under the LocalMachine scope while Visual Studio runs under the CurrentUser (Yes this makes sense)
      
      Set-ExecutionPolicy Unrestricted -Scope CurrentUser
      
      Please read about Set-ExecutionPolicy before using it if you have not used it before as the command above makes powershell the least secure!!
      
      
    • You could also try the setting in Tools->Options->PowerShell Tools->Bypass Execution Policy. This is the same way the NuGet PM console works. It does make it less secure but due to how scripts are run, it needs to happen. 
  • Possible Bug with code-completion
    3 Posts | Last post June 30, 2014
    • I've discovered a code fragment, that appears to break code completion:
      
      	if($someVariable -imatch 'message-id of (?<messageid>\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)'){
      	
      	}
      
      As soon as I include this in my posh code, code-completion stops working in visual studio for that particular powershell file.  Any idea's on why this might be happening?  
      
      Keep up the great work, this has quickly become my favorite editor for my powershell scripts
    • I have the same problem and I found out that is caused by the ">" character, but only in combination with double or single quotes.
      
      $tmp = '>'
      or
      $tmp = ">"
      
      If the ">" character will be written without quotes, intellisense works well.
      
      I tested lots of other special characters, but only this one causes the issue.
    • Weird. I'll have to run some tests to see what's going on. 
  • Error while starting Visual Studio 2013: The 'PowerShellToolsPackage' did not load correctly.
    15 Posts | Last post June 18, 2014
    • I installed this extension and after restarting Visual Studio I got the following message:
      ---------------------------
      Microsoft Visual Studio
      ---------------------------
      The 'PowerShellToolsPackage' package did not load correctly.
      
      
      
      The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\[...]\AppData\Roaming\Microsoft\VisualStudio\12.0\ActivityLog.xml'.
      
      
      
      Continue to show this error message?
      ---------------------------
      Yes   No   
      ---------------------------
      
      In the ActivityLog.xml I found the following entries:
       <entry>
          <record>239</record>
          <time>2013/12/10 14:53:56.799</time>
          <type>Information</type>
          <source>VisualStudio</source>
          <description>Begin package load [PowerShellToolsPackage]</description>
          <guid>{58DCE676-42B0-4DD6-9EE4-AFBC8E582B8A}</guid>
        </entry>
        <entry>
          <record>240</record>
          <time>2013/12/10 14:53:56.833</time>
          <type>Error</type>
          <source>VisualStudio</source>
          <description>SetSite failed for package [PowerShellToolsPackage]</description>
          <guid>{58DCE676-42B0-4DD6-9EE4-AFBC8E582B8A}</guid>
          <hr>80131604</hr>
          <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
        </entry>
        <entry>
          <record>241</record>
          <time>2013/12/10 14:53:56.833</time>
          <type>Error</type>
          <source>VisualStudio</source>
          <description>End package load [PowerShellToolsPackage]</description>
          <guid>{58DCE676-42B0-4DD6-9EE4-AFBC8E582B8A}</guid>
          <hr>80131604</hr>
          <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
        </entry>
      
      
      I am using Visual Studio Premium 2013
      Version 12.0.21005.1 REL
      
      Best regards,
      Stefan
    • That's no good! What OS are you running on? 
    • I'm on Windows 7 Professional SP1 (64 Bit).
    • Do you have PowerShell v3 installed? 
    • No, I don't think so. 
      
      Sorry, I missed that requirement.
      
      In my C:\Windows\System32\WindowsPowerShell folder is only one subfolder named "v1.0".
      
      Looks like I'm 2 versions behind. I'm just starting developing with powershell. 
      
      
    • You can get it here: http://www.microsoft.com/en-us/download/details.aspx?id=34595
      
      The folder doesn't actually change from v1 so you are probably running v2. ;) 
    • >You can get it here: http://www.microsoft.com/en-us/download/details.aspx?id=34595
      
      Thanks, I will check whether an update is an option for our team.
      
      >The folder doesn't actually change from v1 so you are probably running v2. ;)
      
      Oh dear...
    • I get this error in vs2012 after installing PowerShell v4
    • Interesting. I'll need to look into that. I'm pretty sure some people are running Powershell v4 successfully but will test with your configuration to see if I can reproduce. 
    • Let me know if there's anything I can do to help, Powershell ISE really bites :)
    • Actually, I found your source on github and downloaded it, but found that I needed the vs2012 sdk to open it.  After installing the sdk, I found that the error no longer occurs, so there must be a dependency on the sdk?
    • Oh, now that's interesting. I'll have to give that a shot on a clean machine of mine to see if I see the same thing. 
    • Thanks for the tip S Williams, after installing the SDK I am able to use the module with VS 2012 Update 4 on Win 7 x64.
    • Same issue on Windows 7, Visual Studio 2013, VS 2013 SDK, Windows Management Framework 4.0
    • I have the same issue too:
      Windows 7 x64, Visual Studio 2013, VS 2013 SDK, Windows Management Framework 4.0
  • how to reference required modules in TDD tests?
    2 Posts | Last post June 03, 2014
    • Great package, thanks. Still a noob with it, and having a problem setting up TDD for PS projects. I have a solution, and a project, and in the project, a simple script with one function (t1.ps1). I've a t1.tests.ps1 in the project. I've 'install-package'd psate and pshould using nuget console manager. In the solution's directory structure, psate and pshould are in the packages subdir, and t1.ps1 and t1.test.ps1 are in the project subdir.
      
      Pressing F5 (build) with the editor showing t1.tests.ps1, I get "testscope not found." and the build fails.
      
      if I manually unpack psate and pshould to one of my modules subdirectory on the $env:psModulePath, the tests work.
      
      Is PoshTool "supposed" to find the t1.ps1 file, and all modules in the nuget package manger, without me having to manually unpack them? 
      
      Do I need to add the line . $TestScriptPath\t1.ps1 inside the testscope block in the t1.tests.ps1 file?
      
      Any suggestions or examples on how to setup the tests, and how to ensure the tests (and script under test) can find modules, would be appreciated!
      
    • The test adapter will find the modules in the packages dir but running with F5 will not. That would be a great enhancement though to make it play better inside VS. I'd love an issue logged for this.
  • Does this Extension work with VS Shell 2013?
    2 Posts | Last post June 03, 2014
    • I tried using this extension with VS Shell Isolated and Integrated 2013, but I'm told it can't find VS. The logs indicate its looking for Shell 2012.
      
      I can't seem to install Shell 2012 as I'm on Windows 8.1 and Windows Compatibility is blocking me.
    • I think I need to build a special version to support Isolated Shell. I've experimented with it a bit and it's pretty straight forward but haven't had the time to fully implement. It's on my radar. 
  • Visual Studio Express Support
    2 Posts | Last post June 03, 2014
    • Such a great project, one that Microsoft should make native Visual Studio in my opinion. Any chance there will be support for this in Visual Studio Express? Being a non-developer I am light on my Visual Studio usage an consequently don't use a full version.
      
      Cheers,
    • Express doesn't have the necessary parts to run this extension. I hope to support Visual Studio Isolated Shell and that would make it completely free. 
  • Run scripts as x64
    4 Posts | Last post May 12, 2014
    • Any way to make the PowerShell run as x64? 
    • Not at this time, no. Since the runspace is hosted inside VS, which is x86, we're stuck in that world. I have some ideas on how to work around that but haven't implemented anything yet. 
    • Any updates on this topic? Would be great to have some way to kick off 64-bit, even if it's in a different runspace.
      
      Great extension, BTW.
    • Thanks :) Nothing yet. I'm currently working on REPL window support and then will be investigating the x64 support.
1 - 10 of 54 Items