Sign In
 
 
Go Search
 
SharePoint PowerShell “Remoting” Requirements

In a brief “lapse” from the “Intro to PowerShell” sections I wanted to outline some important background for those of you anxious to run your SharePoint administration commands from a remote console.  Keep in mind that just running Enable-PSRemoting is not enough! There are a few unique requirements that the SharePoint environment adds to running remote commands:

1.        You MUST use CredSSP authentication.  Any command that talks to a SharePoint cmdlets that itself talks to SQL (which is most commands) will need to call SQL “as you”.  This means you need the ability to “double hop”—which CredSSP provides.  This is enabled using the “Enable-WSmanCredSSP” cmdlets.    (if you don’t use this you’ll most likely see a message saying the farm does not exist or you do not have enough privledges).

2.       You SHOULD increase the MaxMemoryPerShellMB value on the remote boxes which essentially limits the amount of memory that any single remote process can use.  I would not recommend doing this on every box—but rather an “admin machine” that is not externally available.  The default value is 150MB, which will often fail for Site Collection creation and other long-running commands. You can change this value to a larger value (in this example 1000) using the Set-Item cmdlet:

Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1000

You may hit other “WSman” specific configuration issues along the way—they are often specific to your domain.  However, these error messages are usually quite detailed and I have found over time to always include enough information to solve the problem right away.

Happy remoting!

SP 2010: Intro to PowerShell Part 3

This is another installment in the intro to PowerShell “series”.  I’m going to start using the "Intro to PowerShell" header to differentiate these PowerShell intro topics from other 2010 discussions.

This particular posts is still on using the “pipeline” with SharePoint 2010 PowerShell cmdlets… More advanced stuff will be coming in future posts.

1.       Get all sites from all content db’s in a web application with a particular name
PS>  Get-SPWebApplication "SharePoint - 80" | Get-SPContentDatabase | Get-SPSite –limit all



2.       Get all sites from the 1st database attached to the web application
PS> Get-SPWebApplication | Get-SPContentDatabase |select -First 1 | Get-SPSite –limit all

 

3.       You can also mix SharePoint cmdlets and Windows PowerShell cmdlets together in a single pipeline.  Here we get a sorted list of all site collections from all content databases that start with a particular phrase (WSS_):
PS> Get-SPContentDatabase | Where{ $_.Name –like "WSS_*"}  | Get-SPSite –limit all | Sort URL –Descending

 

4.       The Foreach-Object cmdlet is useful for commands where something other than the Identity is being piped into the object.  For example, when enabling a feature on one or more sites you can use the “Foreach-Object” (which can be aliased with a percent sign ‘%’) to iterate through sites and call a specific command.  For example I can run this command to enable Ratings on one site collection (I’ve left “whatif” on to have it show the behavior—a good thing to always run first!):

PS> Get-SPSite "http://MySharePoint" | ForEach-Object { Enable-SPFeature "Ratings" -url $_.url -whatif }



Or I can run this on all site collections:

PS> Get-SPSite -limit ALL | ForEach-Object { Enable-SPFeature "Ratings" -url $_.url -whatif }

 

5.       Last item for this post: calculated properties.  This is a functionality of the “Select-Object” cmdlets from PowerShell—but very useful for getting data out of SharePoint that may exist at multiple “levels” of SharePoint.  Getting the Usage data from a site collection is a good example—here’s a demonstration:

#Get Usage for a set of site collections—shows a collection for usage

Get-SPSite | Select URL, Usage


#Use a calculate property to “reach inside” the Usage property to get a specific value

Get-SPSite | Select URL, @{Expression={$_.Usage.Storage}}


#Make it cleaner with titles and formatting

Get-SPSite | Select URL, @{Name="Storage"; Expression={"{0:N2} GB" -f ($_.Usage.Storage/1000000)}}


#Then do something with the data!  This new "object" is still pipelineable and actionable (here with GridView)

Get-SPSite | Select URL, @{Name="Storage"; Expression={"{0:N2} GB" -f ($_.Usage.Storage/1000000)}}, @{Name="Quota"; Expression={"{0:N2} GB" -f ($_.Quota.StorageMaximumLevel/1000000)} } | Out-GridView -Title "Sites w/Usage"

 

And below you can see this all in action (I use a limit to make this fit on one screen. Use “–Limit ALL” to have the script display all site collections):

PowerShell 2010: Basic SharePoint Cmdlets

Two important notes for all future PS+SP posts before i begin to give some SharePoint specific cmdlets:

 

First, make sure if you've added any of my "V3/2007" Scripts to your environment to remove them! Functions "Outweigh" cmdlets so you'll be getting "strange" behavior if you load these!

 

Second, i am doing examples to show you possibilities.  Unless i say "always do things this way" or "never do things this way"--then I’m not demonstrating a 'best practice'.  Please don't assume that I will always show the "best" way--just one option.  I'll happily add any alternatives people suggest.

 

With that in mind, here are some starter "SP+PS" samples...

 

1. Get the local farm:

PS> Get-SPFarm

 

2. Get All details of the farm (default is a limited "formatted" view):

PS> Get-SPFarm | Select *

 

3. Get all web applications in the farm:

PS> Get-SPWebApplication

 

4. Get all web applications including Central Administration (CA) web applicaiton:

PS> Get-SPWebApplication -IncludeCentralAdministration

 

5. Get all site collections in the farm (across all web applications, but NOT including CA):

PS> Get-SPSite -Limit All

 

*Note the "limit" parameter.  By default we limit to 20 site collections as "listing all cmdlets" can be a 'large' operation that you should be very aware of doing...

 

6. Use WhatIf to "see what will happen".  No more "run and hope"!

PS> Get-SPSite -Limit All | Remove-SPSite -whatif

 

7. "Destructive" cmdlets will prompt by default (provided the Environment's "Prompt" defaults have not been lowered!)

PS>Remove-SPSite http://contoso

 

8. Prompts can be "suppressed" using "-Confirm:$False" (not recommended!):

PS>Remove-SPSite http://contoso -Confirm:$False

 

*NOTE: "Success" in PowerShell is "No" output.  When an error or warning occurs it will print to screen--ErrorAction, ErrorVariable, WarningAction, and WarningVariable can be used to "script" handling these outputs.

 

As usual, more advanced stuff coming soon!

PowerShell 2010: Basic Discovery

And on the tone of my previous post--no time to start like the present!  First we should start on SharePoint PowerShell "101".  As announced at SPC, we have over 500 cmdets (and even more if you include FAST and PerformancePoint)--but no need to get started memorizing all those; PowerShell offers great "discovery" tools. 

 

Below are some basic samples to get everyone started.  Please note that i'm going to skip some "basic" PowerShell concepts (like "Piping") as there is some great information on the web about these; however, some of these first few posts will be "repeat" for PowerShell regulars.

 

(Note all these commands assume that you have started your PowerShell in the "SharePoint Management Shell" shown below)

 

 

1. This command will return all SharePoint cmdlets available on the local farm:

 

PS> Get-Command -pssnapin Microsoft.SharePoint.PowerShell

 

 

2. This command will get help for the given command (we have "beta" documentation for over 90% of our commands!):

 

PS> Get-Help Get-SPSite

 

 

3. We can even get a set of Examples from cmdlet help:

 

PS> Get-Help Get-SPSite -Examples

 

 

4. This command will give you a list of all the "Service" related cmdlets in the local SharePoint install:

 

PS> Get-Command -noun "SPService*" | Sort Noun

 

 

5. This command will simplify #3 by only showing the unique "objects" (aka. Nouns) that are available in PowerShell:

 

PS> Get-Command -noun "SPService*" | Sort Noun | Select Noun -Unique

 

 

 

6. Need to figure out what properties or methods a .NET SharePoint object has on it?  Instead of MSDN, try:

 

PS> Get-SPSite http://webapplication | Get-Member

 

 

That’s all for now!  More demos—from the simple to the most advanced—coming soon!

SPC09, SharePoint 2010, And PowerShell
Thanks to everyone who made it to the PowerShell talk at SPC!  Hope you all enjoyed the demos and are now "officially excited" for the SharePoint 2010 Beta!
 
What's also exciting about this event--the NDA is lifted!  If you haven't figured it out, I worked heavily on the PowerShell story for SharePoint 2010 and will be releasing scripts, demos, and concepts through this blog in the coming months... 
 
As usual, feel free to suggest additional comments, questions, or ideas.
SPC09 Session: PowerShell
I hope you're all at the SharePoint Conference, but even those who are not are probably enjoying all the excited new features.  Among these--PowerShell Integration! 
 
If you're at the conference and you want to see how PowerShell for SharePoint really works, you should come see my session Thursday @ 9am.  We'll do a wide range of tasks--from the most basic to the truly exciting!
 
Hope to see you there...
Announcing the Fourth Release of the Microsoft SharePoint Administration Toolkit

[Since i used to post there here first, cross posting from the SharePoint Team Blog]

I’m pleased to announce that the fourth version of the Microsoft SharePoint Administration Toolkit is available for download!  This is our last planned offering of new features and functionality for this toolkit that services both Microsoft Office SharePoint Server 2007 and Windows SharePoint Services v3.0.   That said, we do plan to release a separate new toolkit for SharePoint 2010.  With this release we added functionality to address various difficult administrative tasks.  These include SharePoint Diagnostics Tool improvements, the Permissions Reporting Tool, the Quota Management command, and Security Configuration Wizard Manifests.  Let’s look at these areas:

SharePoint Diagnostics Tool (SPDiag) update

The SharePoint Diagnostics Tool (SPDiag) version 2 contains several important updates and new features that increase its effectiveness as a troubleshooting tool.  All SPDiag version 1 functionality has been retained, although some existing functions and features have been improved.

· A Diagnostics tab has been added which executes predefined rules designed to discover and report against some of the most common SharePoint issues.

· Command line data collection and data import has been added so that you can collect data from all servers in a farm for a given time range without installing the complete SharePoint Administration Toolkit on the target farm.  The data can then be relocated to a remote computer and imported into a new project for offline analysis.

· Trend view zoom has been added to the performance monitor graph so that you can click and drag a specific time frame—updating all other frames to the new timeframe.  Zooming out is as simple as a right click.

You can see detailed instructions on improvements on SPDiag on Microsoft TechNet:

· SharePoint Diagnostics Tool (Office SharePoint Server)  (http://technet.microsoft.com/en-us/library/dd745013.aspx)

· SharePoint Diagnostics Tool (Windows SharePoint Services)  (http://technet.microsoft.com/en-us/library/dd745013.aspx)

Permissions Reporting Tool

In the past, customers have had a difficult time trying to detect what sites in a site collection have broken inheritance from the parent and thus why they cannot access some sites.  The Permissions Reporting tool for SharePoint makes it very easy to detect where inheritance has been broken in a site collection.  You can compare an object like a list or a site against its parent to see where inheritance was broken and run reports to get more information on such sites. You can also check effective permissions for a user or a group in a particular site, web, or list in a site collection; this feature lists the permissions that a user or group has.

Once the Permissions Reporting tool is installed in the farm, a site collection administrator can go to the top-level site or any subsite in a site collection and use the links on the Site Settings page to reap the benefits of the tool. The following image shows the new links that appear after you have installed the Permissions Reporting tool in the farm.

Note: To be able to see the links for Broken Inheritance Reports Jobs and Compare Permissions Sets, you must be a site collection administrator. However, anyone with the Enumerate Permissions permission — by default, people in the site Owners group — will be able to see the Check Effective Permissions link.

1. Click Broken Inheritance Report Jobs to run reports of broken sites in a site collection. Reports contain any information relevant to a broken inheritance. The report output is in XML, but you can save the files and then open them in Excel to see the information at a glance. For more information, see Run broken inheritance reports on Office.com.

2. Click Check Effective Permissions to check a user or group’s permissions on a site, list, or item. You can view what permissions are allowed and denied and any blocking permissions. For more information, see Check permissions for a user or group on Office.com.

3. Click Compare Permission Sets to compare an object such as a site or a list against its parent to quickly detect which object breaks inheritance in your site collection. For more information, see Compare permission sets on Office.com.

Quota Management

In the current version of SharePoint Products and Technologies, once a quota limit is applied to a site collection, the only way to change the limit is to manually update the quota limit for each site collection or write custom code. The updatequota operation the toolkit adds to stsadm does not have any parameters to globally set a quota limit change (that is, from 2 GB to 5 GB). The quota limit change is set by an administrator by using Central Administration Web site. Once the limit change is set, you then use the updatequota operation the toolkit adds to stsadm to apply the change to the specific site collections.

For example, you have a quota template named “Global” with a quota limit of 2 gigabyte (GB) that has been applied to 2,000 site collections. Currently, there is no automated way to modify existing site collections with this value. With the updatequota stsadm operation, the quota limit for all existing site collections using the Global quota template can be automatically increased or decreased as needed.

Security Configuration Wizard Manifests

Security Configuration Wizard (SCW) is an attack surface reduction tool introduced with Windows Server 2003 Service Pack 1. SCW uses a roles-based metaphor to solicit the functionality required for a server and disables the functionality that is not required. By automating this security best practice, SCW helps to create Windows environments that are less susceptible, on the whole, to security vulnerabilities that have been exploited.

For more information about the Security Configuration Wizard in Windows Server 2003, see the Security Configuration Wizard Documentation (http://go.microsoft.com/fwlink/?LinkId=162647).

The SCW manifests for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 are included in the SharePoint Administration Toolkit v4.0. The manifests add the SCW roles for Office SharePoint Server 2007 and Windows SharePoint Services 3.0 to Windows Server 2003.

For installation instructions, see

WSS: Installing the SharePoint Administration Toolkit (Windows SharePoint Services) (http://technet.microsoft.com/en-us/library/cc508987.aspx)

Installing the SharePoint Administration Toolkit (Office SharePoint Server) (http://technet.microsoft.com/en-us/library/cc508849.aspx)

For more detailed information about the SharePoint Administration Toolkit, see following documentation on TechNet:

    SharePoint Administration Toolkit (Office SharePoint Server) (http://technet.microsoft.com/library/cc508851.aspx
   SharePoint Administration Toolkit (Windows SharePoint Services) (http://technet.microsoft.com/en-us/library/cc508986.aspx)

The download links for the SharePoint Administration Toolkit v4.0

  x64: http://www.microsoft.com/downloads/details.aspx?FamilyID=665e98ea-5318-486d-aba2-2bfe46254357   (http://go.microsoft.com/fwlink/?LinkID=142035)

  x86: http://www.microsoft.com/downloads/details.aspx?FamilyID=cd2d09a7-1159-4d40-be1c-8efab1345381   (http://go.microsoft.com/fwlink/?LinkId=141504)

Dan Winter
SharePoint Program Manager

SharePoint 101: What’s a Host Header Site Collection?

I often get asked to differentiate the different ways to configure URLs for site collections—most often how Host Header (HH) Site Collections fit into the mix—so I thought I’d try to disambiguate this for everyone.  In the simplest explanation, there are three types of Site Collections:

 

·    Load-Balanced URL web application:   A single root URL that is shared amongst all contained site collections.  For example, you could have http://sharepoint, http://my, or http://teams.  There is one root site collection (matches web application URL) and additional site collections can be created at Managed Paths under this URL (http://sharepoint/sites/zach).

·    Host header web applications: Similar to a load-balanced URL web application, except the URLs all use a single host header (e.g.: http://www.foo.com).

·    Host Header Site Collection: These are site collections that each have their own unique host header. For example, http://foo.com and http://bar.com.  These sites are by far the easiest to rename—use STSADM –o RenameSite to change a HH Site Collection host header.  These site collections must still be hosted in a web application—but the Web App URL or Host Header is ignored for these sites.

 

While host header site collections give the most flexibility for offering multiple unique FQDNs, there are some limitations:

 

·    Only 1 site collection can use a unique Host Header

·    Managed Paths do no work

·    AAMs are not used as part of site lookup for HH Site Collections, so URL re-writing will not work

·    SSL Termination at the load balancer will not work  (due to lack of AAM support)

 

It’s important to note that Host Header Site Collections can only be created from the command line—in the STSADM command createsite, provide the Host Header for the SPSite in the URL parameter and then provide the url of the web application that will host the HH Site Collection.   The good news is that for those of you familiar with previous versions of SharePoint, there is no longer a “Host Header Mode”; HH Site Collections can be created at anytime on existing web applications.

SharePoint 101: Full Width Rich Text Editor
It can be a little frustrating in SharePoint when the "Rich Text Editor" on the edit page of Wiki's, Blogs, or on certain lists is set to fixed column width.  I certainly find it easier to blog in a fullscreen-width editor!
 
Here's the CSS to make it happen (warning, this syntax applies to ALL rich text editors!).   The first does all normal forms and wikis:
 
#onetIDListForm, #onetIDListForm .ms-formbody, #onetIDListForm iframe[title="Rich Text Editor"]{
 width:100% !important;
}
 
And this does the same for Blogs!

.ms-formbody span span div iframe, .ms-formbody span span table.ms-long{
 width:100%; text-align:left;
}

Hope this helps.
Your Comments
Many people are leaving comments--and I'm having a hard time finding them! I get hundreds of "Spam" comments a day, so i'm having to filter through them to find the real ones...  I'm working on a fix, but it might take a while.
 
-Zach
1 - 10 Next

 ‭(Hidden)‬ Admin Links