“Sign as different user” for SharePoint site

By default, you won’t find “Sign as different user” option in SharePoint, but most of them as a developer or superuser need to log in with different users to see the content rendering based on different permission and role. So there are two ways to open the SharePoint site in different users.


You need to just append “_layouts/closeConnection.aspx?loginasanotheruser=true”  to your Site Absolute Url and just hit enter, it will show you the pop up for credentials. There is no browser restriction for the same.

URL: _layouts/closeConnection.aspx?loginasanotheruser=true


This method is only applicable in the SharePoint on-prem site.

The second method is to run a user browser to “Run as different user” mode. So to open any browser as the different user just simply press shift and right-click on the browser exe file, it will show you the option “Run as different user”, select this option and it will pop up for credentials. Enter the credentials for the user which you trying to log in and open your SharePoint site.


Get error line number powershell program

If someone wrote a PowerShell program, with multiple lines and without caring the coding standard and you got stuck to find where the error is, so very simplest way which I am thinking is just use below piece of code which saves your time and let you know about a line which is having an issue.

InvocationInfo can provide information about how and where this command was invoked

So just use simple try-catch like below

try {
    #<replace with your code>
catch {
    $_ |select -expandproperty invocationinfo
    write-host "$($_.Exception.Message)" -foregroundcolor red