Tuesday, April 15, 2014

Useful STSADM Command



STSADM Command (SharePoint Team Services Administration)

Before you run to STSADM command, you are required to run command prompt with “Run as Administrator” .  In common prompt, you have to change directory to

C: \ Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin>

  • To backup SharePoint Team Site without user permission
    • stsadm -o export -url  <url of your team site> -filename <file location>
       You are able to see one .export file and multiple .cmp files in your  file location. In .export file, all logs will be recorded.
       
  • To backup SharePoint Team Site with user permission 
    •  stsadm -o export -url  <url of your team site> -filename <file location> -includeusersecurity
       You are able to see one .export file and multiple .cmp files in your  file location. in .export  file, all logs will be recorded.

  •  To restore SharePoint Team Site without user permission 
    • Create one Team Site in SharePoint 
    • import-spweb -identity “Create Team Site Url” -path <your exported file e.g D:\test.cmp>
       
  • To restore SharePoint Team Site with user permission 
    • import-spweb -identity “Create Team Site Url” -path <your exported file e.g  D:\test.cmp> -includeusersecurity

  •  To increate Team Site Template Limit 
    • stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 524288000

Retracting and Deploying SP Solution in Sharepoint Server 2010



Yesterday, I encountered one problem when I tried to retracting farm solution in SharePoint Server.
. Here is the SharePoint Power Shell code to retract. 

Uninstall-SPSolution –Identity <Name of wsp file>.wsp –Webapplication “<your application name>”

But it stuck the status with “ Retracting(Scheduled ….)”. Then I cancelled the job and retract with force command

Uninstall-SPSolution –Identity <Name of wsp file>.wsp –Webapplication “<your application name>” –force -confirm:$false

It still stucking. Then tried to cancelled the job and remove with force command using following code.

Remove-SPSolution -identity <Name of wsp file>.wsp –Webapplication “<your application name>” -force -confirm:$false

The solution has been removed from server. Then tried to add the solution.

Add-SPSolution “File Location and File Name (e.g D:\test.wsp)”.

Solution has been successfully added. Then tried to install the solution to SharePoint Sever.

Install-SPSolution –Identity <Name of wsp file>.wsp –Webapplication “<your application name>”.

But still stuck. Then I restarted the sharepoint timer services.

Net stop sptimerv4.

When I run this in command prompt, the service cannot stop and it stuck in Stopping.
Then open Task Manager -> Processes Tab -> Select Show Processes from all Users
Kill all process of w3wp.exe and OWSTimer.exe.

After that I reset IIS Server in command prompt
 iisreset /noforce

Then tried to stop and start sharepoint timer services.

Net stop sptimerv4.
Net start sptimerv4.

SPTimer services is restarted successfully.
Then install spsolution to sharepoint server.
Now SPSolution deployed successfully in sharepoint server. JJJ