Showing posts with label Sharepoint. Show all posts
Showing posts with label Sharepoint. Show all posts

Wednesday, August 20, 2014

Adding Windows PowerShell Cmdlets

 You may all have seen some error like below when running a command on Windows PowerShell. This usually occurs when the command PowerShell snap-in is not added.

The term 'Get-SPWebApplication' is not recognized as the name of a cmdlet, function, script file, or operable program.

Solution:  How to add the required snap-in if not already added from the PowerShell script itself.


# Example to add SharePoint Cmdlets [ SharePoint should be installed on machine ]
if ( (Get-PSSnapin -Name Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PsSnapin Microsoft.Sharepoint.Powershell
    Write-Output "`n Snap-in Microsoft.SharePoint.PowerShell added."
}
else
{
    Write-Output "`n Snap-in Microsoft.SharePoint.PowerShell already added."
# Example to add SQL Cmdlets [ SQL management tools should be installed on machine ]
if ( (Get-PSSnapin -Name SqlServerCmdletSnapin100 -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PsSnapin SqlServerCmdletSnapin100
    Write-Output "`n Snap-in SqlServerCmdletSnapin100 added."
}
else
{
    Write-Output "`n Snap-in SqlServerCmdletSnapin100 already added."
}
if ( (Get-PSSnapin -Name SqlServerProviderSnapin100 -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PsSnapin SqlServerProviderSnapin100
    Write-Output "`n Snap-in SqlServerProviderSnapin100."
}
else
{
    Write-Output "`n Snap-in SqlServerProviderSnapin100 already added."
}

Tuesday, June 24, 2014

SharePoint 2013 - Enable Sign in as a Different User




1. Find and open the following file from the Sharepoint 15 hive
 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES\Welcome.ascx'

2. Add the following control code before the control having ID 'id="ID_RequestAccess"' and save the file.
<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
 Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
 Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
 MenuGroupId="100"
 Sequence="100"
 UseShortId="true"
 />




3. Reload the SharePoint web application and check again. 'Sign in as a Different User' should be visible now :)

Saturday, May 3, 2014

Handle Sharepoint HTTP basic window authentication - using selenium webdriver java


import org.openqa.selenium.Alert;
import java.awt.*; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent;
// Switch to alert window. Alert authenticationWindow = driver.switchTo().alert();
// Type the username/email. authenticationWindow.sendKeys("<username/email address>");
// Shift cursor focus to password input text field. Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_TAB);
// Type the password in password field. [ Selenium does not know at this point that the cursor focus is shifted, so calling Alert class instance sendKeys() will cause password to be typed in username field. So, we are copying the password first to windows clipboard and then pasting it directly into the password field using  Robot class instance ] StringSelection stringSelection = new StringSelection("<user password>"); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection,null); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL);
// Accept the authentication window. robot.keyPress(KeyEvent.VK_ENTER);

AWS Certified Solutions Architect Associate - AWS Introduction - Questions

All the Best !!! Show Result !! Try Again !! ×