none
Unable to get the details of SharePoint while accessing remotely through windows Powershell

    Question

  • Hello All,

    I would like to get my SharePoint server details remotely(from another device) through windows PowerShell.

    As we know, to run the SharePoint commands in windows powershell we must add SharePoint PSSnap-In.

    Add-PSSnapin Microsoft.SharePoint.PowerShell

    I am able to get the details when I try to run the SharePoint commands in my SharePoint server( locally) after adding this snap-in.

    But facing a problem when I try to get it from remotely.

    Even though I added this snap-in, SP related commands are not working remotely.

    Can someone please help me on this.

    Thanks.

    Wednesday, April 19, 2017 8:50 AM

All replies

  • Hello,

    I think there is a authentication issue as you are running PS from remote location, follow the below steps in sequence

    1- Add PSSnapin

    2- Get object of your SPSite

    3- Grant access to specific user e.g.

    $web = Get-SPWebApplication -Identity http://yourwebapplication
    $wweb.GrantAccessToProcessIdentity("domain\username")



    Vivek Jagga
    My Blog
    Follow Linkedin Group   


    • Edited by Vivek Jagga Wednesday, April 19, 2017 9:28 AM
    Wednesday, April 19, 2017 9:28 AM
  • Hi Eswari303,

    There is a TechNet blog about how to enable Remote PowerShell for SharePoint 2013, you can refer to it:

    https://blogs.technet.microsoft.com/anneste/2014/09/17/how-to-enable-remote-powershell-for-sharepoint-2013-for-non-administrators/

    Thanks,

    Wendy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, April 20, 2017 9:32 AM
    Moderator
  • Ideally to get SharePoint server details remotely outside of SharePoint server, you need to use client side model.

    Instead of calling  Add-PSSnapin Microsoft.SharePoint.PowerShell from windows powerShell, load the Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime like below. 

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

    You might need to install the client components from https://www.microsoft.com/en-gb/download/details.aspx?id=35585 if you have not already done so else, the assemblies Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime won't load.

    With client object model however , not all Share Point server details are accessible.


    Friday, April 21, 2017 2:05 PM
  • Client components aren't a replacement for SSOM. There are too many operations that are either significantly more complex or just outright unavailable. Wendy's post is the correct way to go about using remote PoSh with SharePoint.

    Trevor Seward

    Office Servers and Services MVP



    Author, Deploying SharePoint 2016

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, April 21, 2017 3:16 PM
    Moderator