Showing posts with label PowerGUI. Show all posts
Showing posts with label PowerGUI. Show all posts

Monday 4 November 2013

PowerShell Tools for Visual Studio

Problem:  I like PowerGUI for my PowerShell IDE but I want to be able to work with my PS files with source control (TFS). 

Initial Hypothesis:  Ideally I want Visual studio to work like PowerGui namely, providing line count, local variables, debugging, colour coding and intelesense.

Resolution:
PowerGui has a plug-in for Visual Studio but it only works on old versions of PowerGui.  I find it not worth the errort for the value the tool adds.

PowerShell Tools for Visual Studio is a VSIX plugin for Visual Studio that appears to meet all my requiremnts.

More Info:
http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

Sunday 9 December 2012

Setting up VMs (VMware ESX5)


Overview:  VMware ESXi is a 1st class virtualisation platform and commonly used to host SharePoint VM's.  The post looks at the common tools for managing/setting up my VMware based infrastructure.  I'm certainly not an expert in virtualisation but this is a 101 in setting up VM's.
 
vSphere Client connects to the ESXi server infrastructure and provides a UI management tool.
 
PowerShell with PowerCLI to let you manage your ESX infrastructure using PowerShell. 
My preferred option is to use PowerGUI and user the add the PowerCli add in so I can interact with ESX but I have Intellisense and nice debugging capabilities.   The snippet below shows how to connect to the ESXi server.
Script expanded with more detail.  Really need to loop throu config to create multiple VM's and get their individual settings.
Before running the script ensure you have the OSCustomizationSpec and OS template as you need them to build.
Check the VM is created.
Summary:  Useful scripts for building a unique set of VM's on VMware.  For Continuous Integration it is better to start with pre-build environments.  My next step would be to fire off the SQL Server 2012 builds on 1 or more of these VM's as shown in the SQL Server 2012 slipstreamed install.

Thanks to Wayne Senior for info in this post.

Thursday 23 June 2011

SP2010 install using AutoSPInstaller from PowerGUI

Problem: I want to install SharePoint 2010 using Brian Lala's AutoSPInstaller codeplex project however, I want to be able to see values and debug using PowerShell

Resolution:
Ensure AutoSPInstaller is setup correctly and PowerGUI is installed.  Correct setup is shown below.  Ensure that the xml file is named correctly.

Tip: Windows has a built in graphical debuggger for PowerShell called ISE Editor
http://blogs.msdn.com/b/powershell/archive/2009/01/19/debugging-powershell-script-using-the-ise-editor.aspx
PS> c:\SP2010\AutoSPInstaller\AutoSPInstallerMain.ps1 c:\SP2010\AutoSPInstaller\AutoSPInstallerInput-WIN-2C5PI8TSRPA.xml

Press F5 or the arrow to debug.  I have all the .ps1 files in the PowerGUI editor and add break points. 

Note.  If you hit a break point and press F5 once you are debugging, PowerGUI will not stop at the next break point.  F10 will take you to your next breakpoint or where the next error is trapped.

Wednesday 8 June 2011

Powershell Setup for SharePoint Developers

Overview:  PowerGUI (from Quest Software) provides a PowerShell(PS) GUI to perform actions with minimal customisation you get Powershell with Intellesense and colour coding that is SharePoint aware.  Additionally you can plug in a Visual Studio (VS) plug-in (VSIX) that allows you to have PowerGUI functionality directly within you VS IDE.

1.> Install PowerGUI
1.1.> Download PowerGUI at http://www.powergui.org/ I installed version 2.4.0
1.2.> Install the PowerGUI msi on your development server

2.> Configure PowerGUI
2.1.> Open the PowerGUI application
2.2.> Add the Microsoft.SharePoint.PowerShell module as shown below:
3.> Write a PS script
3.1.> Open the "PowerGUI Script Editor" by clicking Tools > PowerGUI Script Editor
3.2.> Ensure your intellesense is working by typing "Get-SP", you will see the intellisense pick up the GET-SPSite cmdlet.
3.3> Add the following command and debug with a break point to see PowerGUI in action.  This will get all the Content Types associated to the RootWeb of a specific Site Collection.  Note the variables windows on the right hand side of the PowerGUI interfaces allows you to examine each of the variable objects declared in the script.
It's not full intellesense but it is a huge help to get you most of the way to writing custom PS.

4.> Add PowerGUI Visual Studio 2010
4.1.> Add the "PowerGUI VSX" through extension manager (VSIX) (Tools > Extension Manager > Online Gallery > Search for .. PowerGUI > Download.
4.2.> VS2010 will reboot, ensure VS2010 is open, click "View" > "PowerGUI Console".  You can use the console to write PS.
4.3.>  The VSIX also provides an SPI for adding PS Scripts as shown below:



Error msg:
PS E:\Windows\system32> Add-PSSnapin -Name Microsoft.SharePoint.PowerShell
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.SharePoint.PowerShell' is not installed on this machine.

References:
PowerGUI and SharePoint 2010

Update: 19/07/2012 - I downloaded the latest version of PowerGui 3.2.0.2237 and tried to call SharePoint scripts arfer adding the SP add-in and got the following error:
Get-SPFarm : Microsoft SharePoint is not supported with version 4.0.30319.237 of the Microsoft .Net RuntimeFix navigate to: C:\Program Files (x86)\PowerGUI\ScriptEditor.exe.config and edit the xml.  I comented out the line telling PowerGui to use .NET 4.0.