Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

November 09, 2014

SharePoint Uninstall, Remove, Add, Install SPSolution .wsp using PowerShell or STSADM

This is gonna very often command that you will keep using to Add and Activate solution in SharePoint Environment so you can bookmark it or follow the blog.

Well the deployment process includes below set of steps to Remove and Add Solutions in SharePoint.
1.      Retract
2.      Remove
3.      Add
4.      Deploy

First Deactivate Solution then Remove Solution, then Add Solution from local drive and Activate to desired scope.

There are 3 simple ways to do so.
·        From SharePoint site, go deactivate then from CA retract and remove solution.
·        Second way is STSADM.exe
·        Third and most preferred way is PowerShell.

Uninstalling SharePoint wsp package using PowerShell command

Uninstall-SPSolution –Identity “MySolution.wsp” –WebApplication “WebApp Url”

Remove SharePoint wsp package using PowerShell command

Remove-SPSolution–Identity "MySolution.wsp"

Add SharePoint wsp package using PowerShell command

Add -SPSolution "C:\Praveen\MySolution.wsp"

Installing SharePoint wsp package using PowerShell command

Install-SPSolution –Identity "MySolution.wsp" –WebApplication "url" –GACDeployment

Using STSADM command

open command prompt and Go to path,
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN
 
Add Solution
stsadm.exe -o addsolution -filename "c:\Praveen\MySolution.wsp"
 
Deploy Solution
stsadm.exe -o deploysolution -name "MySolution.wsp" -url "http://server/" -allowgacdeployment -immediate

Activate feature
stsadm.exe -o activatefeature -name "MySolution.wsp" -url "http://server/"




--
Regards,
Praveen Pandit



September 07, 2014

Production Server maintance daily alert email using powershell, check free space

Well we have number of servers for productions so going to each server (WFE, DB, Application and DMZ servers) etc and checking for frees pace and running services etc that's really hectic and that it time consuming environment that may have 4WFE 2DB 1Application and 1DMZ server.

In short we should create task scheduler and run PowerShell script that can check for free space, running services and process etc... and send 1 email for all these details.

Here I am sharing sample script :
1) Production Server maintenance daily alert email using powershell:checking free space of C drive.



You can download above code to check free space, from here.



--
Thanks,
Praveen Pandit

June 08, 2014

PowerShell Create lookup, how to create cross site lookup in SharePoint

SharePoint  gives us an easy way to create lookup columns in same site (in developers language same Web ;) ) but some time we have to create lookup column between two different sites, well there is no direct option provided by Microsoft. But there is simple way to do it using PowerShell.

All you need to know is web/Site names and list names and executive below lines of code....


powershell CrossSite Lookup










You can download this piece of code here.



Thanks,
Praveen Pandit

November 20, 2013

SharePoint Site lock, unlock, Web unable to update, delete, add options are invisible, unable to see recycle bin, site is locked, how to make site ready only , unlock site



SharePoint came with so many new features and functionality. it is stable and matured technology.
if user if unable to see edit, delete or Add button even has full control and contribute permission or also unable to see recycle bin. One of the reason of it you Site / Web is locked and no database related update can be made (in short no update). here you may got my point. the site or Content DB is locked we need to unlock it. it happens it your backup or restore is interrupted or some SharePoint job is couldn't completed.

Or some time you are doing some important task, like doing scheduled backup or restore. or anything related to it. so you don't want changes during you process. it simple lock it.

Now how should we lock ant site or unlock. the best and easiest way is PowerShell.


 PS C:\Users\Admin> $site =Get-SPSite -Identity “http://SiteOrWebUrl”  
 PS C:\Users\Admin> $site.MaintenanceMode   
 True  
 PS C:\Users\Admin> $Site.ClearMaintenanceMode  
 PS C:\Users\Admin> Set-SPSite -Identity “http://SiteOrWebUrl” -LockState "Unlock"  


Another way it stsadm command, which is also preferred and easy way.

 C:\Users\Admin> stsadm -o setsitelock -url http://xxx -lock none  


Don't forget to run command prompt with elevated privileges!


Please share yours findings or issue if any on this.

--
Thanks for visiting!!,
Praveen Pandit

SharePoint PowerShell How to Rename Field or column name




PowerShell has ability to update every property that is available to edit in bulk and ofcourse in Sharepoint, Really it’s a awesome scripting language...

its simple just have SPWeb then SPList then its field and rename its Display name by using 'Title' property


 $w=Get-SPWeb –identity “http://serverurl/weburl”  
 $fld= $w.Lists[$spListName].Fields[“FieldName”]  
 $fld.Title = “Field New Name”  
 $fld.Update()  


You can simple user foreach loop for all lists or All sites to do so.

We cannot change its internal name if you wanna do so take backup of list delete specific column / field and recreate with new name.






Please share yours findings or issue if any on this.

--
Thanks for Visiting!
Praveen Pandit