none
Access Denied when try access $site.RootWeb.Lists over powershell remoting

    Question

  • I've a problem with access to every $site.RootWeb.Lists over powershell remoting.
    When I try this I'm getting the following error:

    Exception calling "Add" with "3" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

    Full command:

    $site = Get-SPSite http://mysite
    $site.RootWeb.Lists
    The following exception occurred while trying to enumerate the collection: "Access is denied. (Exception from HRESULT:0x80070005 (E_ACCESSDENIED))".
    At line:1 char:1
    + $site.RootWeb.Lists
    + ~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
        + FullyQualifiedErrorId : ExceptionInGetEnumerator

    When I run powershell on the sharepoint server under the user which I also use for remoting (run as) everything works correct. 
    When I use the account which was used to install the farm over remoting then its also working.

    The which is used for remoting is farm admin and site collection admin. When I login over the UI I can also access all stuff (including Lists).

    Any ideas where I've to search the error?

    Edit:
    ULS Log:

    System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:   
     at Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId, String strListName)    
     at Microsoft.SharePoint.SPListCollection.EnsureListsData(String strListName)    
     at Microsoft.SharePoint.SPBaseCollection.GetEnumerator()    
     at System.Management.Automation.EnumerableOps.GetEnumerator(IEnumerable enumerable)    
     at CallSite.Target(Closure , CallSite , Object , Pipe , ExecutionContext )    
     at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)    
     at System.Management.Automation.Interpreter.ActionCallInstruction`5.Invoke(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)    
     at System.Management.Automation.Interpreter.CallInstruction.InvokeInstance(Object instance, Object[] args)    
     at System.Management.Automation.Interpreter.DynamicInstructionN.Run(InterpretedFrame frame)    
     at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)    
     at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)    
     at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)    
     at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)    
     at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)    
     at System.Management.Automation.CommandProcessorBase.DoComplete()    
     at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)    
     at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)    
     at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()    
     at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()    
     at System.Management.Automation.Runspaces.LocalPipeline.StartPipelineExecution()    
     at System.Management.Automation.Runspaces.PipelineBase.CoreInvoke(IEnumerable input, Boolean syncCall)    
     at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)    
     at System.Management.Automation.PowerShell.Worker.RunspaceAvailableCallback(IAsyncResult asyncResult)    
     at System.Management.Automation.Runspaces.AsyncResult.SetAsCompleted(Exception exception)    
     at System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.ServicePendingRequests(Object useCallingThreadState)    
     at System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.EnqueueCheckAndStartRequestServicingThread(GetRunspaceAsyncResult requestToEnqueue, Boolean useCallingThread)    
     at System.Management.Automation.PowerShell.CoreInvokeAsync[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings, AsyncCallback callback, Object state, PSDataCollection`1 asyncResultOutput)    
     at System.Management.Automation.PowerShell.BeginInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings, AsyncCallback callback, Object state)    
     at System.Management.Automation.ServerPowerShellDriver.Start(Boolean startMainPowerShell)    
     at System.Management.Automation.ServerRunspacePoolDriver.HandleCreateAndInvokePowerShell(Object sender, RemoteDataEventArgs`1 eventArgs)    
     at System.Management.Automation.Remoting.ServerRemoteSessionDSHandlerStateMachine.DoMessageReceived(Object sender, RemoteSessionStateMachineEventArgs fsmEventArg)    
     at System.Management.Automation.Remoting.ServerRemoteSession.DispatchInputQueueData(Object sender, RemoteDataEventArgs dataEventArg)    
     at System.Management.Automation.Remoting.BaseTransportManager.OnDataAvailableCallback(RemoteDataObject`1 remoteObject)    
     at System.Management.Automation.Remoting.ReceiveDataCollection.ProcessRawData(Byte[] data, OnDataAvailableCallback callback)    
     at System.Management.Automation.Remoting.PriorityReceiveDataCollection.ProcessRawData(Byte[] data, DataPriorityType priorityType, OnDataAvailableCallback callback)    
     at System.Management.Automation.Remoting.BaseTransportManager.ProcessRawData(Byte[] data, String stream)    
     at Managed_ShellSession.CreateCommand(Void* pluginContext, _WSMAN_PLUGIN_REQUEST* requestDetails, UInt32 flags, UInt16* commandLine, _WSMAN_COMMAND_ARG_SET* arguments)    
     at Managed_WSMAN_PlugIn.CreateCommand(Void* pluginContext, _WSMAN_PLUGIN_REQUEST* requestDetails, UInt32 flags, Void* shellContext, UInt16* commandLine, _WSMAN_COMMAND_ARG_SET* arguments)    
     at Managed_WSMAN_PlugIn.PerformWSManPluginCommand(Void* pluginContext, _WSMAN_PLUGIN_REQUEST* requestDetails, UInt32 flags, Void* shellContext, UInt16* commandLine, _WSMAN_COMMAND_ARG_SET* arguments)    
     at WSManPluginCommand(Void* pluginContext, _WSMAN_PLUGIN_REQUEST* requestDetails, UInt32 flags, Void* shellContext, UInt16* commandLine, _WSMAN_COMMAND_ARG_SET* arguments)

    

    • Edited by Marc Sallin Tuesday, January 15, 2013 8:43 PM
    Tuesday, January 15, 2013 7:55 PM

Answers

  • Contacted the MS support.

    Running to following command for the account which is used to authenticate over ps remoting to get it running:

    $w = Get-SPWebApplication -Identity http://portal

    $w.GrantAccessToProcessIdentity("domain\username")

    • Marked as answer by Marc Sallin Saturday, March 02, 2013 4:30 PM
    Saturday, March 02, 2013 4:30 PM

All replies

  • Contacted the MS support.

    Running to following command for the account which is used to authenticate over ps remoting to get it running:

    $w = Get-SPWebApplication -Identity http://portal

    $w.GrantAccessToProcessIdentity("domain\username")

    • Marked as answer by Marc Sallin Saturday, March 02, 2013 4:30 PM
    Saturday, March 02, 2013 4:30 PM
  • Thank you!  This worked!
    Friday, November 15, 2013 8:40 PM
  • Worked perfectly! Thanks
    Monday, May 18, 2015 11:00 AM
  • THIS. IS. AWESOME!

    Wish I found this a few dozen hours ago haha. How is it not in any of the documentation I can't fathom it, but will save in my notes for future reference :-)

    Friday, July 31, 2015 4:10 PM