Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to create a script that creates a page based on a template.

New-SPWeb -url http://site/project/project01 -template OFFILE#1 -name "01"
Import-SPWeb http://site/project/project01 -Path C:\Backup\tamp.bak

Is there a possibility to change the name and description website usign powershell?

The reason I use the exported packages due to the fact that I want to have a library of set right.

share|improve this question

2 Answers 2

Something similar to the following should do the trick.

$spAssigment = Start-SPAssignment
$web = Get-SPWeb -site http://sitename/sites/site1 -Identity http://site/project/project01 
   -AssignmentCollection $spAssignment
$web.Title = "..........."
$web.Update()
Stop-SPAssignment $spAssignment

notice: Start-SPAssignment and Stop-SPAssignment are only an alternative way of disposing the SPWeb istance.


EDIT

I forgot to change the description of the web in the above sample. Anyway, you could just use Set-SPWeb.

Get-SPWeb -Identity http://site/project/project01 | Set-SPWeb 
    -Title "My new title" -Description "My new description"

See the sample here

share|improve this answer
    
Change the description works well. But as I want to change the parameter title, gets an error. code Get-SPWeb site/project/project01 | Set-SPWeb -Title "01" ` ` Set-SPWeb : A parameter cannot be found that matches parameter name 'Title'. At line:1 char:65 + Get-SPWeb site/project/project01 | Set-SPWeb -Title <<<< "01" + CategoryInfo : InvalidArgument: (:) [Set-SPWeb], ParameterBindi ngException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.SharePoint.Powe rShell.SPCmdletSetWeb ` –  MichalW Nov 5 '12 at 12:59

This will update the title after the web has been restored:

$web = Get-SPWeb http://YOURSiteCollection.test.de
$web.Title="NEW"
$web.update()
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.