Showing posts with label sharepoint 2013. Show all posts
Showing posts with label sharepoint 2013. Show all posts

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

May 04, 2014

SharePoint 2013 auto fill people picker, auto fill people editor in application page (aspx) C#

Microsoft always comes with some new and more user friendly features in every new version. Well this client people picker (which is auto fill by user name, email or login id) new and simple control introduced in SharePoint 2013, that will save lot of time of ours.

instead of using below people picker of sharepoint 2010

<SharePoint:PeopleEditor ID="spPeoplePicker" runat="server" Width="350" SelectionSet="User" />

and setting javascript we can use  PeopleEditor to make it easy and faster for end user we can use below control in SP2013

aspx syntax :
<SharePoint:ClientPeoplePicker ValidationEnabled="true" ID="pplDemo" runat="server" VisibleSuggestions="5" AutoFillEnabled="True" AllowEmailAddresses="true" Rows="1" AllowMultipleEntities="false" CssClass="ms-long ms-spellcheck-true" Height="85px"  />



C# Code to get SPUser:
if( pplDemo.ResolvedEntities.Count > 0)
{
SPUser oUser = oWeb.SiteUsers[((PickerEntity)pplDemo.ResolvedEntities[0]).Key];

                         if (oUser != null)
                         {
                              // do your stuff.
                         }
}

C# Code to Set User to Client People Picker control:
 
 pplDemo.InitialUserAccounts = "UserEmail1";
 



Thanks,
remaining getting and saving values in SharePoint is same as earlier.

You can Share your findings or issue here.


--
Thanks,
Praveen Pandit

December 22, 2013

Error: Cannot connect to the configuration database. ; getting error while hitting Windows SharePoint websites or Central Administrator



 Error "Cannot connect to the configuration database" when you connect to a Windows SharePoint websites or Central Administrator.





This problem occurs when you made some update on windows / install or uninstall  of MS products. You may have tried IISreset or server reboot but nothing worked. So lets try below point

1)    By looking at massage a school guy can say its unable to connect Sql Database. So first step is to check Sql services and try to start/restart and check.Refer Link for details.
Still that doesn’t work you can try below option
2)    Try to reconfigure Sql
 It may be Your configuration trying to connect to the DB via the wrong port. Ir may be incorrect configuration setting accounts and all. Or may be firewall rule blocking you. To resolve this you can do Configuration of DB by configuration wizard you can refer Link for details.
3)    Again this didn’t worked you it means your services and configuration is correct lets use some commands to do it work refer Link.
4)    Go to Sql management and give permission to account
5)    Or go to SQL server configuration manager change service account and try again by restarting/starting Sql services and again make old account and retry.


Don't forget to run with elevated privileges!


You can share your views, issue or findings below, on this.

--
Regards,
Praveen Pandit

November 20, 2013

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