Add Login as different user link to navigation

11/04/2014 13:25

Login as different user personal menu item is missing in SP 2013. One of workarounds is to add link to navigation. Url of this link is https://yoursitecollection/_layouts/closeConnection.aspx?loginasanotheruser=true

Here is the script to do so (but of course, you can do it manually)

$webUrl = https://yoursitecollection


$nodeName = "Login as different user"
$nodeUrl = $webUrl + "/_layouts/closeConnection.aspx?loginasanotheruser=true"
$web = Get-SPWeb $webUrl

$node = $web.Navigation.TopNavigationBar
$item = $node'where-object {$_.Title -eq $nodeName}
#create new link in Global Navigation, if doesn't exist
    "Link '{0}' already exists in Global Navigation on '{1}'." -f $nodeName, $webUrl
    "There is no '{0}' link in Global Navigation Menu. Creating..." -f  $nodeName
    $newNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($nodeName, $nodeUrl)
    "Link '{0}' was succesfuly added to Global Navigation on '{1}'." -f $nodeName, $webUrl