jueves, 8 de agosto de 2013

PowerShell

Get-SPSite | where {$_.url -like "http://a *"}
Get-SPFarm | Format-List Id, BuildVersion, Servers, Solutions
Add-PSSnapin Microsoft.SharePoint.Powershell
===========
ExecuteHelloWorldScript from batchfile
powershell -Command "& {.\Hello.ps1}" -NoExit
pause

powershell -Command "& {Set-ExecutionPolicy bypass}" -NoExit

===========
CreateContosoSite
if($args) {
  $SiteName = $args[0]
  $SiteUrl = "http://a:3811/sites/ " + $SiteName
  Write-Host "Begin creating Contoso site at" $SiteUrl
  Write-Host
  $NewSite = New-SPSite -URL $SiteUrl -OwnerAlias Administrator -Template STS#1 -Name $SiteName
  $RootWeb = $NewSite.RootWeb
  $RootWeb.Title = "Contoso Site: " + $SiteName
  $RootWeb.Update()
  Write-Host "New Contoso site successfully created"
  Write-Host "-------------------------------------"
  Write-Host "Title:" $RootWeb.Title -foregroundcolor Yellow
  Write-Host "URL:" $RootWeb.Url -foregroundcolor Yellow
  Write-Host "ID:" $RootWeb.Id.ToString() -foregroundcolor Yellow
}
Else {
  Write-Host "ERROR: You must supply Name as parameter when calling CreateContosoSite.ps1"
}

===========
GetSharePointDlls
$path = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14"
Get-ChildItem $path -recurse |
  Where-Object {$_.name -like "*SharePoint*.dll"} |
  Sort-Object -Property Name -unique |
  Format-Table Name

===========

GetSharePointPublishingFeatures
Get-SPFeature -Limit ALL |
  Where-Object {$_.DisplayName -like "*Publishing*"} |
  Sort-Object -Property Scope
  Format-Table DisplayName, Id, Scope

===========
.\GetSharePointPublishingFeatures.ps1
Get-SPFarm | Format-List
Get-SPSite | where {$_.url -like "http://a *"}
.\CreateContosoSite.ps1 lab01test

===========

Grant Active Directory Domain Services permissions for profile synchronization in SharePoint Server 2013

http://technet.microsoft.com/en-us/library/hh296982.aspx

jueves, 1 de agosto de 2013

Clear old SharePoint 2010 Database after remove service application

When you remove your service application, you can see on page “Management Databases Upgrade Status” (http://central_administration/_admin/DatabaseStatus.aspx) still your database, but physically is database deleted.
In the event log can be repeated critical message..
SQL Database 'db_name' on SQL Server instance 'sql_instance' not found. Additional error information from SQL 

Server is included below.

Cannot open database "db_name" requested by the login. The login failed.
Login failed for user 'login'.

You can remove database using PowerShell…
get-spdatabase | where {$_.name -eq 'db_name'} | foreach {$_.Delete()};

lunes, 29 de julio de 2013

SharePoint REST interface with operators and functions

Introduction

What information the article has
  • various operators that can be used with REST interface
  • various functions that can be used with REST interface

Skill Level – Medium

Filter operators

Following are the various filter operators that can be used with REST interface
eq Equal to
ne Not equal to
gt Greater than
ge Greater than or equal to
lt Less than
le Less than or equal to
and Logical and
or Logical or
not Logical negation
add Addition
sub Subtraction
mul Multiplication
div Division
mod Modulo
( ) Precedence grouping

Functions

Following are the various functions that can be used with REST interface
bool substringof(string s0, string s1)
Checks whether s0 is within s1
bool endswith(string s0, string s1)
Checks whether s0 ends with s1
bool startswith(string s0, string s1) 
Checks whether s0 starts with s1
int length(string s)
Length of string s
int indexof(string s0, string s1)
Index of string s0 within s1
string insert(string s0, int pos, string s1)
Inserts s0 into s1 at position pos.
string remove(string s0, int pos)
Removes characters from position pos in s0
string remove(string s0, int pos, int length)
Removes length characters from position pos in s0
string replace(string s0, string f0, string s1)
Replaces f0 in s0 with s1
string substring(string s0, int pos)
Returns the substring from position pos in s0
string substring(string s0, int pos, int length)
Returns the substring from position pos in s0 with the length characters
string tolower(string s0)
Transforms s0 to lowercase
string toupper(string s0)
Transforms s0 to uppercase
string trim(string s0)
Removes leading and trailing whitespaces
string concat(strings s0, string s1)
Concatenates two strings
int day(DateTime dt)
Day of the date dt
int hour(DateTime dt)
Hour of the date dt
int minute(DateTime dt)
Minute of the date dt
int month(DateTime dt)
Month of the date dt
int second(DateTime dt)
Second of the date dt
int year(DateTime dt)
Year of the date dt
double round(double dbl)
Rounded value of dbl with double precision
decimal round(decimal dec)
Rounded value of dec with decimal precision
double floor(double dbl)
Floor value of dbl with double precision
decimal floor(decimal dec)
Floor value of dec with decimal precision

Examples of usage

/Employees?$filter=Id eq 1
Filter using the eq operator extracts exactly one element if the filtered element is unique
Employees?$filter=’Jac,Arth’ eq concat(FirstName, concat(‘,’, LastName))
Filter after concatinating the column values
Employees?$filter=year(Modified) eq 2010
Filter on the year of the Modified property
Employees?$filter=Id eq 3 and substring(Department, 0, 1) eq ‘I’
Filter on the result set along with expression

Conclusion

REST interface is a great way of accessing SharePoint data and hope the above operators and functions will give grater ability

Listar Site Collections desde PowerShell

En el siguiente script, listamos todas las colecciones de sitios y su tamaño en MB, luego convertimos la salida a HTML:

Get-SPSite -Limit ALL | select url, @{label=”Size in MB”;Expression={$_.usage.storage/1MB}} | Sort-Object -Descending -Property “Size in MB” | ConvertTo-Html -title “Site Collections sort by size” | Set-Content d:\temp\size.html

miércoles, 24 de julio de 2013

Project Server 2013

Requerimientos para instalar Project Server 2013. 

Aquí está el enlace para configurar las cuentas administrativas y servicios de Project Server 2013.

Implementación de Project Server 2013, en diferentes escenarios.