how to connect sqlserver using powershell

how to connect sqlserver using powershell
Here we can find the script the way we can connect sqlserver DB using PowerShell.

$con = New-Object System.Data.SqlClient.SqlConnection
$con.ConnectionString = "Server=servername;Database=databasename;User ID=username;Password=password;"
$con.Open()
$sql = "your select query"
$cmd = New-Object System.Data.SqlClient.SqlCommand($sql,$con)
$rdr = $cmd.ExecuteReader()
$test = @()
while($rdr.Read())
{
    $test += ($rdr["fieldname"].ToString())
}
#here we can see the output using

Write-Output $test

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

how to send email with attachment in powershell

how to send email with attachment in powershell
$Body = "get the information here to show the data with attachement"  | Set-Content C:\somename.html

$file = "C:\somename.html"
$EmailFrom = "FromMail@Domain.com"
$EmailTo = "ToMail@Domain.com"
$SMTPServer = "Your Smtp Server Name"
$EmailSubject = "Enter Your Subject"
$att = new-object Net.Mail.Attachment($file)

#Send mail with attachment
$mailmessage = New-Object system.net.mail.mailmessage
$mailmessage.from = ($EmailFrom)
$mailmessage.To.add($EmailTo)
$mailmessage.Subject = $EmailSubject
$mailmessage.Body = $Body
$mailmessage.IsBodyHTML = $true
$mailmessage.Attachments.Add($att)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer)
$SMTPClient.Send($mailmessage)
$att.Dispose()
SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

How to send email using powershell in sharepoint

How to send email using powershell in sharepoint
Here we can see the script,the way we can sent mail alerts using power shell

$EmailFrom = "FromEmail@domain.com"
$EmailTo = "ToEmail@domain.com"
$SMTPServer = "YourSmtpServerName"
$EmailSubject = "Enter your Subject you want"

$mailmessage = New-Object system.net.mail.mailmessage
$mailmessage.from = ($EmailFrom)
$mailmessage.To.add($EmailTo)
$mailmessage.Subject = $EmailSubject
$mailmessage.Body = "Email body"
#if we are sending any html body we have to use below line
$mailmessage.IsBodyHTML = $true
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer)
#if you want any network credentials set user name and password.
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("username", "password");
$SMTPClient.Send($mailmessage)

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

How to add extra name infront of Newsfeed(SuiteBarLeft) in SharePoint 2013

    In SharePoint 2013, we can easily add text  in-front of Newsfeed (SuiteBarLeft) in top right side by customizing the master page.


Now we are going to add text(Lakshmi) by using master page, Navigate to SharePoint Designer
  •  Open your SharePoint site what you want...
  •  Click on All Files in left side ->_catalog -> masterpage
  •  I am using default master page Seattle.master, going customizing Seattle.master page. Right click on it Check out and Edit file in Advance mode.
  •  Search for "DeltaSuiteLinks" and add the following code in below as shown in figure.
   <span id="idtextds" class="classtextds">
     <a href="http://www.dotnetsharepoint.com/">
       <asp:Label ID="lblds" runat="server" Text="Lakshmi"></asp:Label>
     </a>
   </span>



Save and Check In the master page , now we can it as shown below







SharePoint 2013 Administration Course Detail

SharePoint 2013 Administration Course Detail
                                  SharePoint 2013 Administration

 Getting started with SharePoint 2013 

  • SharePoint Foundation Architecture 
  • SharePoint 15 Product SKUs 
  • What's New in SharePoint 2013 
  • Windows PowerShell Primer 


 Installing SharePoint Server 2010 
  •  Hardware Requirements 
  •  Installing Prerequisite Software 
  •  Creating Dedicated Service Accounts 
  •  Installing SharePoint Server 2013 
  •  Creating the Farm and Configuration Database 

 Topology and Configuration 
  •  Understanding Farm Topologies 
  •  Configuring Managed Accounts 
  •  Managing Timer Jobs 
  •  Creating and Configuring Service Applications by hand 
  •  Creating and Configuring Service Applications using PowerShell 

Configuring Security and User Authorization 
  •  The Fundamentals of Claims-based Security 
  •  Configuring Integrated Windows Authentication with Kerberos vs. NTLM 
  •  Configuring Forms-based Authentication (FBA) 
  •  Outsourcing User Management to External Identity Providers such as Windows Live 
  •  Configuring a Trust to the Windows Azure Access Control Service (ACS) 

 Creating and Configuring Web Applications 
  •  Creating New Web Applications 
  •  Configuring Web Application 
  •  Managing Content Databases 
  •  Creating Site Collections 
  •  Configuring Self-service Site Collections 

 Managing Site Collections and Tenancies 
  •  Site Templates 
  •  Capacity Planning 
  •  Site Collection Security 
  •  Understanding Tenancies 
  •  Configuring Subscriptions 

Business Connectivity Services 
  •  BCS Architecture External Data Sources 
  •  Creating and Configuring External Contents Types 
  •  Configuring Profile Pages and External Lists 
  •  BCS Enhancements involving OData Support 

 The Managed Metadata Service 
  •  Overview of the Managed Metadata Service 
  •  Enhancement to the Managed Metadata Service in SharePoint 2013 
  •  Creating and Managing Term Sets, Terms and Taxonomies 

 Working with Document Sets 
  •  Configuring a site collection as a Content Type Publishing Hub 
  •  Using The Secure Store Service to configure Advanced Authentication Techniques 

 Configuring the User Profile Service 
  •  Overview of User Profiles and Social Networking 
  •  Create and Configuring a User Profile Service Application (UPA) 
  •  Create and Configuring The User Profile Synchronization Service (UPS) 
  •  Creating and configuring Audiences 
  •  Creating and Managing My Sites 
  •  Understanding User Task Synchronization using the Work Management Service 

 RE POINT 2013 ADMINISTRATION 
  •  Configuring a Search in SharePoint 2013 
  •  The New Unified Search Architecture of SharePoint 2013 
  •  Creating and Configuring Content Sources 
  •  Understanding the Content Processing Pipeline 
  •  Introduction to Result Sources, Result Types and Query Rules 
  •  Working with Managed Properties 

Health Monitoring and Optimization 
  •  The Developer Dashboard 
  •  Working with ULS Logs 
  •  The Logging Database 
  •  Health Analyzer and Usage Reporting 
  •  Timer Jobs and Server Affinity 
  •  The New Request Manager in SharePoint 2013 

 Deploying and Monitoring Custom Solutions 
  •  Deploying and Managing Farm solutions and Sandboxed Solutions 
  •  Introduction to the new SharePoint App Model 
  •  Configuring SharePoint App Authentication using OAuth 
  •  Configuring SharePoint App Authentication using Server-to-server (S2S) Trusts 

 Preparing for Backup, Restore, and Disaster Recovery 
  •  Versioning and Restoring Documents 
  •  Configuring Recycle Bin Behavior 
  •  Backup and Restore of site collections, Content Database and Farms 
  •  Preparing for Disaster Recovery 
  •  Recovering the Farm After Server Failure 

 Upgrading Content from SharePoint 2010 to SharePoint 2013 
  •  Upgrade Concepts and Terminology 
  •  Deprecated Upgrade Techniques from SharePoint 2010 
  •  Preparing for Database Attach 
  •  Migrating Content 
  •  SharePoint 2010 UI Mode versus SharePoint 2013 UI Mode 

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

The workbook cannot be opened sharepoint 2013

I am trying to open the Excel WorkBook(.xslx) in the browser I am getting the error like this




So now I started to resolve this issue checked weather that particular user having DB Permissions or not.
We have to give db_owner Permissions to that particular user in SQL Server.
Login to DB->Security->Logins->
If user is already there check the Server roles and User Mapping Permissions.
In User mapping we have to give access to SharePoint Content DB as “db_owner”.
Once we give Permissions Check it will work.
We give Permissions using Power Shell Commands also

$p =Get-SPWebApplication –Identity<Url of the Webappliction>
$p.GrantAccessToProcessIdentity(“Domainname/username”)

Even though if you are having the same issue
Configure diagnostic logging
Central Admin->Monitoring->Configure diagnostic logging
Select the Check box for Excel Services and Check the Logs

Find with text “Error” you can find the correct error.

The attempt to create a page from that document failed with the following error: Converting the document to a page failed. The converter framework returned the following error: CE_BACKENDUNAVAILABLE

The attempt to create a page from that document failed with the following error: Converting the document to a page failed. The converter framework returned the following error: CE_BACKENDUNAVAILABLE
In CentralAdmin->System Settings->manage services on server

Stop the Document Conversion Launcher Service
Stop the Document Conversion Load Balancer Service

Start the Document Conversion Load Balancer Service
Start the Document Conversion Launcher Service


Make sure that document conversion services always start in a proper order.

Backup and Restore SharePoint 2013 site collection using PowerShell

Backup and Restore SharePoint 2013 site collection using PowerShell
If you want to take backup/restore your site collection in SharePoint, we can do with PowerShell Commands.

Backup site collection in SharePoint using PowerShell

Backup-spsite  -Identity sitecollectionname  -path location to store the back up

Backup-spsite  -Identity http://dotnetsharepoint  -path C:\TestBackup.bak

Restore site collection in SharePoint using PowerShell

Restore-SPSite -Identity create new site collection -path location to restore the back up


Restore-SPSite -Identity http://CreatNewSiteCollection -path C:\TestBackup.bak

SharePoint 2013 Product configuration wizard failing at step 9/10

SharePoint 2013 Product configuration wizard failing at step 9/10
When we are tried to run the Configuration wizard, after installing the Patches.
In Some cases we can get failing at step 9/10.
Solution:
Clear the Cache.ini
Go to Location C:\ProgramData\Microsoft\SharePoint\Config
Now we can able to see the GUID’s
In Right hand side Corner top Search like cache.ini
Open the cache.ini and reset the value to 1
Run the Command stsadm -o execadmsvcjobs
After that finally run
Psconfig.exe -cmd upgrade -inplace b2b -wait -force