PowerShell Tools for Visual Studio 2013


PowerShell integration for Visual Studio

(39) Review
Visual Studio
Download (80,228)
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Reviews (39)
Q and A (60)
Sign in to write a review
Sort by:

by Ed (DareDevil57) | Thu 3:22 PM

by Ransher Singh | August 13 2014

Excellent addon for developers/system administrators alike.

by Thomas Freudenberg | August 09 2014

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.


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 |

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

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 |

Thanks, Lee!

by Rob Plank | March 13 2014

by bgoldsht | February 24 2014

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.


Adam R Driscoll March 23 2014
| Edit |

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

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

  • Feature Request
    1 Posts | Last post Tue 9:00 PM
    • Hello Adam,
      I made a suggestion for a change on GitHub. To use your add-in for my application I need to make a modification to the plug in so that I can run it from the console in our test environment  Issue:#115. The suggested change doesn't require the solution context to run the plugin. What do you think?
  • Crashes VS 2013 when opening a blank PS1 file - zero bytes in size
    2 Posts | Last post Tue 2:34 AM
    • I'm experiencing a crash that takes down VS 2013.
      Create a new PowerShell Script Project in VS.
      Script.ps1 is created with the comments # Script.ps1 which is good.
      Right click on the project, add new item, Powershell Script.  Script1.ps1
      Click somewhere in the file that just opened.
      Reopen VS, open the solution. Note the solution wasn't saved before the crash.  
      Right click on the project, add existing file, select Script1.ps1.
      Save the solution.
      Double click on Script1.ps1 from the Solution Explorer.
      Click somewhere in the file that just opened.
      Open Script1.ps1 in notepad, add a # to the file.
      Save, close.
      Reopen VS, open the solution. 
      Double click on Script1.ps1, it opens fine and I can work on it.
      Add some text to Script1.ps1.
      Save it.
      Close the file.
      Double click on Script1.ps1 from the Solution Explorer. it opens fine and I can work on it.
      Remove all text from Script1.ps1.
      Save it.
      Close the file.  
      Double click on Script1.ps1 from the Solution Explorer.
      Click somewhere in the file that just opened.
      Looks to be when it's zero bytes in size, the IDE crashes.
    • Wow. Easy to repro. Thanks for reporting. Hadn't seen that before. I'll look into it. 
  • Non-critical but annoying completion bug
    2 Posts | Last post Tue 2:33 AM
    • Anyone else seeing this? When using tab completion in a PS file, the string that's inserted into the file is some part of what you typed, PLUS the completion matching value.
      Here are a couple of examples:
        1. If you type "Get-con" in the editor (no quotes) and select Get-Content from the completion menu, what is placed into the file is GetGet-Content.
        2. If you type "get-itemp" in the editor (no quotes) and select Get-ItemProperty from the completion menu, what is placed into the file is get-iGet-ItemProperty.
      The pattern appears to be that what is placed into the edit buffer is the first N characters you have typed + the entire matching completion string, where N is the number of characters AFTER the - that you have typed. So for the above examples:
        1. The Get is prepended because con was typed after the -.
        2. The get-i is prepended because itemp was typed after the -.
      So the only case that works correctly is if you type the -, and then select from the menu without entering any more characters.
    • Yuck. I don't know how that one slipped by. I'll look into it. 
  • Folders not working under PowerShell project in VS2013 Update1 and 2
    4 Posts | Last post August 13, 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.
      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? 
    • Hi, I have the same problem. I have another module installed (CKS Dev for Visual Studio). When Powershell and CKS dev are installed, a right-click on folder in a Powershell project frozed the Visual Studio.
      Need an update to this.
    • Thanks for the info. Will have to check out the CKS Dev stuff to see what I can do. 
  • Pester TestAdapter didn't discover the tests
    2 Posts | Last post August 13, 2014
    • I am running Visual Studio 2013 Ultimate with Update2 on an x64 Win7 machine. I installed your latest visx (Version="1.0.1") and couldn't see the tests in the unit test explorer window.
      I disabled the strong name validation on "PowerShellTools.TestAdapter.dll" and the tests now appears in the unit test explorer window.
      Is there a prerequisite that I am missing?
    • I've placed Pester module in both C:\Windows\System32\WindowsPowerShell\v1.0\Modules & C:\Windows\Syswow64\WindowsPowerShell\v1.0\Modules(just to be sure) but not in  <SystemDrive>:\Users\XXXX\Documents\WindowsPowerShell\Modules\Pester.
      Will give that a go.
  • An exception occurred while invoking executor 'executor://pestertestexecutor/v1': The parameter cannot be null or empty. Parameter name: message
    6 Posts | Last post August 12, 2014
    • I am using Pester to test powershell. It works properly from the cmdline in powershell, however, when loaded in visual studio (using this extension) the test cases load property but I receive the following exception from the output window.
      An exception occurred while invoking executor 'executor://pestertestexecutor/v1': The parameter cannot be null or empty.
      Parameter name: message
      Does anyone know what this means? 
      My Environment
      Windows 8.1
      Visual studio 2013 update 3
      I installed the latest version of pester from git. That said i don't see a version when i call get modules on my box, but this was the latest bits just updated at the time i am reporting this problem.
      ModuleType Version    Name
      ---------- -------    ----
      Manifest    Microsoft.PowerShell.Management
      Manifest    Microsoft.PowerShell.Security
      Manifest    Microsoft.PowerShell.Utility
      Manifest    Microsoft.WSMan.Management
      Script     0.0        Pester
    • Also i did try to enable the diagnostic logging (similar to suggested in the previous thread), but there doesn't seem to be any other details provided in the output window. I also looked in the event log. 
    • Hey Shane,
      Could you send me an example of the test you are trying to run? It'd be great if you could open an issue on GitHub. It sounds like the results of the tests aren't being processed correctly. 
    • Thanks Adam for the response. 
      I can do better :) The problem went away when I installed Pester from Nuget rather than manually from the Git repository. I am not positive why the version on Git has the issue, or if I made some other bad configuration deploying it as instructed from the Git site. It did otherwise run ok from powershell though. It could be that it is a later version that has an incompatibility, so I can open a bug for them to take a look.
      I don't want to overload this thread as to confuse you but I have noticed some other issues now that I am running with this.
      1.) Visual studio seems to deadlock between loading and running test cases. I can usually run the in visual studio a couple of times, but after a while running the cases is disabled (they load and look fine) (I think the problem relates to the following)
      Discover test started ------
      ------ Discover test started ------
      A discovery request is already in progress. Only one active discovery request is supported.
      At this point it is probably hung trying to discover test cases, and won't let me run test cases subsequently.
      This is with your latest update.
    • Thanks for the info! I will have to look into it. There was a bit of logic to look for NuGet-installed modules when discovering tests so maybe there is something awry in there. 
      As for the hung test discovery, I haven't seen that one but will have to take a look into it. That must be really annoying. 
    • Thank you!
      The other key for people:
      I believe this is required to exist for the plug in to work. 
      <SystemDrive>:\Users\XXXX\Documents\WindowsPowerShell\Modules\Pester (copy module to this directory). 
  • Breakpoints fail with null reference on 1.0.0
    5 Posts | Last post August 04, 2014
    • I've been running the new 1.0.0 version now for a week+, and really like the improvements and fixes. I've encountered a show-stopper regression though. Wondering if I'm the only one and whether there's a workaround.
      I can set breakpoints in my PS code and everything looks fine until running the script. It runs until hitting the BP, at which point the program crashes with a null reference exception similar to this:
      [ERROR] D:\tfs\dcwa\temp-dev\dcwa\Root\CentralAdmin\Test\LocalKraken\LocalKraken.ps1 : Object reference not set to an instance of an object.
      [ERROR] At line:1 char:1
      [ERROR] + . 'D:\tfs\dcwa\temp-dev\dcwa\Root\CentralAdmin\Test\LocalKraken\LocalKraken.ps1' ...
      [ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      [ERROR]     + CategoryInfo          : NotSpecified: (:) [LocalKraken.ps1], NullReferenceException
      [ERROR]     + FullyQualifiedErrorId : System.NullReferenceException,LocalKraken.ps1
      The program 'LocalKraken.ps1: PowerShell Script' has exited with code 0 (0x0).
      The line number of the exception matches the line number where the breakpoint was hit.
      I've tried clearing all breakpoints, deleting the user setting files, restarting VS, adding true/false conditions, but none of that had any effect. The net effect of this issue is that I can't use the debugger any more: this is a big loss.
      I never saw this on previous versions. Any suggestions to help me get this working?
    • Nasty. I haven't run into this issue. I will take a look this evening. Could you get a log? 
      Tools->Options->PowerShell Tools
    • I can't repro. A log and even a sample script where it's happening would be great. 
    • Thanks for investigating this. It repros for me with the below simple script. I also have a diagnostic log created while loading the solution, setting and clearing a few breakpoints, and running to the crash, but it's too big to append to this post. I'll see if it fits in a post by itself.
      One thing to note: before doing this, yesterday I uninstalled 1.0.0 and reinstalled 0.8.5 to try to get to a good state. Turns out I still had the repro on 0.8.5, even though it previously worked on this machine. I put 1.0.0 back on before running this repro:
      # Script.ps1
      if (!$name)
          $name = 'Franz Ferdinand'
      Write-Host "What's your name? "
      $input = Read-Host "Please enter your name -> "
      if ($name-ne $input)
          Write-Host "Liar!"
          Write-Host "Duly noted."
    • Getting the log into this discussion would take 8 posts or so, so I emailed a .zip to gmail account posted at your blog.
  • Error while starting Visual Studio 2013: The 'PowerShellToolsPackage' did not load correctly.
    16 Posts | Last post August 01, 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:
          <time>2013/12/10 14:53:56.799</time>
          <description>Begin package load [PowerShellToolsPackage]</description>
          <time>2013/12/10 14:53:56.833</time>
          <description>SetSite failed for package [PowerShellToolsPackage]</description>
          <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
          <time>2013/12/10 14:53:56.833</time>
          <description>End package load [PowerShellToolsPackage]</description>
          <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
      I am using Visual Studio Premium 2013
      Version 12.0.21005.1 REL
      Best regards,
    • 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
    • I hadthe same problem:
      Win 7 x64, VS2013 Pro, Windows Management Framework v3, 2013 SDK.
      I installed Microsoft Visual Studio 2013 SDK and that solved the problem for me, you can find it here http://www.microsoft.com/en-us/download/confirmation.aspx?id=40758
          <time>2014/08/01 18:57:45.691</time>
          <description>Begin package load [PowerShellToolsPackage]</description>
          <time>2014/08/01 18:57:45.691</time>
          <description>SetSite failed for package [PowerShellToolsPackage]</description>
          <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
          <time>2014/08/01 18:57:45.691</time>
          <description>End package load [PowerShellToolsPackage]</description>
          <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
  • Project properties went away
    3 Posts | Last post July 28, 2014
    • 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,
    • 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. 
1 - 10 of 60 Items