Wednesday, November 25, 2015

Wednesday, November 18, 2015

Create PowerShell ISE Enabled for SharePoint

2013

Are you tired of typing in …

Add-PSSnapin Microsoft.SharePoint.PowerShell

How to Add PowerShell cmdlets for Sharepoint to ISE

Note that if you are using SharePoint 2013 running on Server 2012 use the following updated steps

Start by making sure ISE is loaded

(HINT) Get-WindowsFeature will display entire list

image

If ISE is not added then add by

Running powershell as local administrator

import-module servermanager
add-windowsfeature powershell-ise


image
Note that in this example it is already loaded.

Create ISE Profile

Now you need to create a profile (this has changed)

image

To create a profile for the current user use:

if (!(test-path $profile ))
{new-item -type file -path $profile -force}

To edit the new profile use:

psEdit $profile

image

Then type the following in the ISE Scripting Pane and click Save.

add-pssnapin microsoft.sharepoint.powershell

Test ISE with SharePoint commands

Close/Open ISE and give it a test, now you have ISE enabled with SharePoint

image

image

Technet Reference

To create a new profile you need to decide from one of 4 scenarios listed below.

To create a new “Current user, Windows PowerShell ISE” profile, run this command:

if (!(test-path $profile ))
{new-item -type file -path $profile -force}

To create a new “All users, Windows PowerShell ISE” profile, run this command:

if (!(test-path $profile.AllUsersCurrentHost))
{new-item -type file -path $profile.AllUsersCurrentHost -force}

To create a new “Current user, All Hosts” profile, run this command:

if (!(test-path $profile.CurrentUserAllHosts))
{new-item -type file -path $profile.CurrentUserAllHosts -force}

To create a new “All users, All Hosts” profile, type:

if (!(test-path $profile.AllUsersAllHosts))
{new-item -type file -path $profile.AllUsersAllHosts-force}

To edit a profile

  1. To open the profile, run the command psedit with the variable that specifies the profile you want to edit. For example, to open the “Current user, Windows PowerShell ISE” profile, type: psEdit $profile
  2. Add some items to your profile. The following are a few examples to get you started:
    • To change the default background color of the Console Pane to blue, in the profile file type: $psISE.Options.OutputPaneBackground = 'blue' . For more information about the $psISE variable, see The ISE Scripting Object Model.
    • To change font size to 20, in the profile file type: $psISE.Options.FontSize =20
  3. To save your profile file, on the File menu, click Save. Next time you open the Windows PowerShell ISE, your customizations are applied.

 

2010

So you want to use the ISE with SharePoint.  First add ISE feature then create a new profile by completing the following steps:

ADD ISE
Running powershell as local administrator

import-module servermanager
add-windowsfeature powershell-ise

(HINT) Get-WindowsFeature will display entire list

ADD Profile
Running powershell as sharepoint administrator
Powershell_ISE
Test-Path $profile (if true jump to Open ISO Profile step below)
New-Item $profile -ItemType file –Force
 
Close current untitled ps1 and open new file created
Open ISE Profile > Open > look in documents for microsoft.powershellies_profile.ps1

add-pssnapin microsoft.sharepoint.powershell

Save File and test by closing ISE and relaunch

(HINT) get-psnapin to display that have been added
(HINT) get-psnapin -registered to display all but ...

Give access to DB use the following powershell from a privileged user shell

$spcdb = get-spcontentdatabase wss_content_intranet
Add-spshelladmin -username contoso\sp_admin -database $spcdb


Reference - Scripting Wife - ISE Profiles
http://blogs.technet.com/b/heyscriptingguy/archive/2011/09/13/the-scripting-wife-creates-a-powershell-ise-profile.aspx

http://blogs.msdn.com/b/kaevans/archive/2011/11/14/add-microsoft-sharepoint-powershell-snap-in-to-all-powershell-windows.aspx

Thursday, November 12, 2015

Codeplex


Check out these cool resources from CodePlex

Tested

Installation
https://autospinstaller.com/ (new)
http://autospinstaller.codeplex.com/

Client Browser
http://autospsourcebuilder.codeplex.com/

SharePoint Client Browser for SharePoint Online and SharePoint on-premise
https://spcb.codeplex.com/

SharePoint 2013 Search Query Tool
http://sp2013searchtool.codeplex.com/

Great Tools from Scott Brickey (Fellow Cincy / Tri-State SPUG member)
http://sdssharepointlibrary.codeplex.com

Workflow Extensions
http://spdactivities.codeplex.com/

Enable Meeting Workspaces in SharePoint 2013
http://sharepointmws.codeplex.com/

 

Suggested

Scan documents from scanners attached directly to the server
http://embdocumentinhalator.codeplex.com/ SharePoint Manager -  browse every site on the local farm and view every property.
http://spm.codeplex.com/

Warm-up Scripts
http://blogs.technet.com/b/praveenh/archive/2013/03/12/sfsgfasg.aspx SP Wakeup - A simple application that touches each site and site collection on a SharePoint or WSS server to rebuild the IIS cache.
http://spwakeup.codeplex.com/releases/view/52800

Master Page Picker
http://spfmasterpageselect.codeplex.com/
http://blog.thedesigndrifter.com/?p=1112 Information or Reference Scot Hillier Presentations
http://hillier.codeplex.com/

Wednesday, November 4, 2015

Displaying XML in SharePoint

So you need to display XML on your page.  Using OOTB tools here is a simple method to display XML in SharePoint 2013

image

Using the demo xml from w3schools

http://www.w3schools.com/xml/xml_xsl.asp

Copy and paste into file … breakfast.xml

<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>Two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>Light Belgian waffles covered with strawberries and whipped cream</description>
<calories>900</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>Light Belgian waffles covered with an assortment of fresh berries and whipped cream</description>
<calories>900</calories>
</food>
<food>
<name>French Toast</name>
<price>$4.50</price>
<description>Thick slices made from our homemade sourdough bread</description>
<calories>600</calories>
</food>
<food>
<name>Homestyle Breakfast</name>
<price>$6.95</price>
<description>Two eggs, bacon or sausage, toast, and our ever-popular hash browns</description>
<calories>950</calories>
</food>
</breakfast_menu>

Copy and paste into file … breakfast.xslt

<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="breakfast_menu/food">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold"><xsl:value-of select="name"/> - </span>
<xsl:value-of select="price"/>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<p>
<xsl:value-of select="description"/>
<span style="font-style:italic"> (<xsl:value-of select="calories"/> calories per serving)</span>
</p>
</div>
</xsl:for-each>
</body>
</html>

Now using SharePoint upload both files to a document library

image

Copy the shortcut for the xml file

image

Using the XML Viewer Web Part

image

Edit the web part

image

and paste the URL to the XML file then do the same for the XSLT file and click ok to save your settings

image

Vola …

image

Reference from Microsoft

https://support.office.com/en-US/article/Use-the-XML-Viewer-Web-Part-to-display-structured-data-and-XML-based-documents-and-forms-00D6ED40-BD73-4754-B869-0477A034BCFD