Import subsite via powershell

Hi,

I would like to import a .cmp file that's a backup of my subsite.
Now on my new Site I would like to do this restore of this subsite. 

Via powershell : 

Import-SPWeb http://tes:666/stage -Path C:\Default3.cmp -Force

What am I doing wrong? Thx

This is my error : 

 

The term 'Import-SPWeb' is not recognized as the name of a cmdlet, function, script file, or operable program. Check th

e spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:13

+ Import-SPWeb <<<<  http://stspdev2:650/stage -Path C:\Default3.cmp -Force

    + CategoryInfo          : ObjectNotFound: (Import-SPWeb:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

May 12th, 2010 10:53am

Hi Joerio,

are you Running this Commandlet from SharePoint 2010 Management Shell or just Windows Powershell?

If you are trying to run this from Windows Powershell you may need to add snapin by running following

Add-PsSnapin Microsoft.SharePoint.PowerShell

If you still get Error then I would like you to specify -verbose Switch at the end and see what error message you get.

 

Free Windows Admin Tool Kit Click here and download it now
May 12th, 2010 4:01pm

Actual command should be Import-SPWeb –Identity http://server/sites/IT/Blog/ -Path C:\Backup\IT\Blog.cmp

You are missing -Identity in your cmdlet

May 13th, 2010 12:18am

Hi Alpesh,

Do we need to create Subsite before Importing..?

Please reply.

Free Windows Admin Tool Kit Click here and download it now
December 13th, 2012 7:32am

hello everyone,

I do have the same issue now, do we need to create sub site before running import using Powershell.

Also According to MS technet article, i dont see the identity in the command for export/import.

https://technet.microsoft.com/en-us/library/ff607613.aspx

Thanks much.

March 31st, 2015 9:40pm

Hi Umesh,

Not sure if the issue still exists for you, to import the site, you can also use powershell. The only caveat is that you must first create the subsite as a 'dummy', and you MUST use the same template. For example, if the site you backed up was based on the 'Teamsite' template, the URL that you are trying to restore to MUST already represent a subsite and it MUST be based on the Teamsite template.

Command as follows:

Import-SPWeb -Identity http://mysite.com/targetSubsite Path c:\\Backup.cmp -IncludeUserSecurity

Free Windows Admin Tool Kit Click here and download it now
July 13th, 2015 9:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics