Get-SPSiteAdministration .DiskUsed return nothing

In the article of moving site collection from one content database to another content database on TechNet, There is a PowerShell script which tells how much space used by the site collection:


$used = (Get-SPSiteAdministration -Identity <http://ServerName/Sites/SiteName>).DiskUsed


$used

If you run this on your SharePoint 2010 Management Shell, you will get nothing displayed when you try to show the value of $used.

You will need to run the following code first before you run the above 2 lines of code


Start-SPAssignment -Global

This is a tip from Microsoft SharePoint forum.

You can also use


$storage = (Get-SPSite http://siteUrl).Usage.Storage

this is will get a much larger value than the previous command. I think the reason is that in the previous command: “The amount of disk space that is displayed does not include the disk space used by the auditing data that will be moved with the site collection.”

Read More

SharePoint 2010: Using PowerShell to create Web Application Pool

You can use the following PowerShell code to create a new Application Pool for your SharePoint site

$svc = [Microsoft.SharePoint.Administration.SpWebService]::ContentService
$pool = New-Object Microsoft.SharePoint.Administration.SPApplicationPool "SharePoint App Pool", $svc
$pool.CurrentIdentityType = "SpecificUser"
$acct = Get-SPmanagedAccount DOMAIN\USER
$processAcct = [Microsoft.SharePoint.Administration.SPProcessAccount]::LookupManagedAccount($acct.Sid)
$pool.ProcessAccount = $processAcct
$pool.Provision()

The application pool will be created.

You can update an existing application’s application pool followed by this script:

$webApp = Get-SPWebApplication http://web
$webApp.ApplicationPool = $pool
$webApp.ProvisionGlobally()
$webApp.Update()

 

You can also switch a web application’s application pool to another by using the following PowerShell Script

$sourceWebAppPool = (Get-SPWebApplication http://web1).ApplicationPool
$webApp = Get-SPWebApplication http://web2
$webApp.ApplicationPool = $sourceWebAppPool
$webApp.ProvisionGlobally()
$webApp.Update()

Read More

How to make document library web part in top level visible to subsites

here is a solution from Anton Khritonekov @stackoverflow.com:

“There are another option without such hard coding. You can open any view of your document library, as mentioned earlier AllItems.aspx for example with SharePoint Designer. Open it for editing in advanced mode (there are option when you click right mouse button on file in SP Designer). Then just point mouse cursor inside web part and chose in ribbon web parts, Add to Site gallery, see the picture. Fill in name of new web part. That is all, now you can add this web part on any page on any web site from webpart gallery through the user interface or through the SP Designer by clicking Insert, Web Part in the ribbon on any page.”

Read More

An exception occurred when trying to issue security token: The security token username and password could not be validated..

SharePoint 2010 Claims Authentication. FBA.

Every time now and then, it failed to authenticate users

Here are the errors:

An exception occurred when trying to issue security token: The security token username and password could not be validated..

Request for security token failed with exception: System.ServiceModel.FaultException: The security token username and password could not be validated.     at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.ReadResponse(Message response)     at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)     at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst)     at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForContext(Uri context, Boolean bearerToken, SecurityToken onBehalfOf, SecurityToken actAs, SecurityToken delegateTo)

SPSecurityTokenService.Issue() failed: System.ServiceModel.FaultException`1[Microsoft.IdentityModel.Tokens.FailedAuthenticationException]: The security token username and password could not be validated. (Fault Detail is equal to Microsoft.IdentityModel.Tokens.FailedAuthenticationException: The security token username and password could not be validated.).

 

Password check on ‘NETWORKID‘ generated exception: ‘System.ServiceModel.FaultException`1[Microsoft.IdentityModel.Tokens.FailedAuthenticationException]: The security token username and password could not be validated. (Fault Detail is equal to Microsoft.IdentityModel.Tokens.FailedAuthenticationException: The security token username and password could not be validated.).’.

 

Recycling the application pools does help. Or restart IIS.

Still trying to figure the real cause.

Read More

Upgrade CentOS 5.4 PHP 5.2 to PHP 5.3

1. Stop HTTPD

service httpd stop

2. Remove all previous PHP installations

yum remove php

yum remove php-*

3. Set up EPEL/IUS Repo

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-11.ius.el5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh ius-release*.rpm epel-release*.rpm

note the red texts should be checked and updated depending on if the CentOS is 32bit or 64bit version. The versions of the rpm files could update too. please check before you run the command.

4. Install PHP 5.3

yum install php53u

yum install php53u-pear php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mbstring php53u-mcrypt php53u-mysql php53u-pdo php53u-soap php53u-xml php53u-xmlrpc php53u-bcmath php53u-pecl-apc php53u-pecl-memcache php53u-snmp

 

—-

note php 5.3 by default disable short open tag <? code…. ?>, so you want to modify your php.ini and change it to

short_open_tag = On

 

Read More

SharePoint Publishing Site Slow to Load Pages: An unexpected error occured while manipulating the navigational structure of this Web

One of our SharePoint Web Application is running extremely slow. It often takes about 2 to 3 minutes to load one single page. All other web applications are running as fast as they should be.

Called DBA and DBA reported there are blockings in the content database. It comes and goes.

Looked into SharePoint Logs and here is what we found:
System.Data.SqlClient.SqlException: Transaction (Process ID 212) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction
PortalSiteMapProvider was unable to fetch children for node at URL: /subsite, message: An unexpected error occured while manipulating the navigational structure of this Web.

It looks like something wrong with this subsite’s navigations.

Went to navigation settings on the root level of the site: http://sharepoint_site/_layouts/AreaNavigationSettings.aspx and removed /subsite from the global navigation. Click OK button and the site is as fast as before.

Except the /subsite. Tried to open http://sharepoint_site/subsite/_layouts/AreaNavigationSettings.aspx but it is almost impossible to get the page load.

Opened the subsite using SharePoint designer, navigate into Pages library. Removed all recently modified publishing pages. Went back to the browser to test the site, and it was gooooooooooooood.

Restore the page one by one, surprisely the issue didn’t occur.

I believe somehow there is a stalled update in the navigations. It never finished and always tried to update the database. By resetting the navigation, it cleared the issue out.

 

 

Read More