Is there a way to add Items to a SharePoint List/Library using the credentials of a non-administrator user?

I am logged on SharePoint server using the Admin account, I have users in my domain which I assigned the below permissions over my SharePoint Site Collection.

spadmin - Full Control - SP Administrator account
user1   - Design       - simple user
user2   - Contribute   - simple user

if I run Powershell as a different user using the user1 credentials, the current session opened on powershell is obviously for user1, after this I execute the next command:

$spweb = Get-SPWeb -Identity "http://misite-D02:36677/sites/SC_1"
$list = $spweb.Lists["Gen_List"]
$list["Title"] = "TestItem" 

the above code fails on commented line, and when I print on screen the value of the list $spweb.Lists the next error is displayed:

The following exception occurred while trying to enumerate the collection: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))".
    + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
    + FullyQualifiedErrorId : ExceptionInGetEnumerator
    + PSComputerName        : misite-D02.testsp.local

My target is add items from PowerShell to lists, in order to have the "Modified By" and "Created By" columns recorded with the name of the user who created/modified them, such as is displayed in the below image:

enter image description here

it is possible do it with spadmin credentials, however I'm not sure with other user credentials or another way

2 Answers 2


You will need to grant the other two user accounts shell access using:

Add-SPShellAdmin [-UserName] <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-database <SPDatabasePipeBind>] [-WhatIf [<SwitchParameter>]]

Most commonly, this would do:

Add-SPShellAdmin -UserName User1 -database Your_content_db_name



It fails because the user does not have shell access.

You could use the SharePoint REST API from PowerShell to work with the site/list/items.

From PowerShell, you can interact with the SharePoint endpoints.

Here is a SP2010 example I created where I'm validating users in a site. You'll want to look at the Lists.asmx service or other endpoint.

Import-Module ActiveDirectory

$webServ = "http://yoursite/_vti_bin/UserGroup.asmx"
$Service = New-WebServiceProxy -UseDefaultCredential -uri $webServ 
$Users = $Service.GetUserCollectionFromWeb().Users 
$UserNames = New-Object System.Collections.Generic.List[System.Object]
$notAd = New-Object System.Collections.Generic.List[System.Object]

$Users.User | ForEach-Object {
$spUser = $_.LoginName.Split('\')[1]

if($_.IsDomainGroup -eq $false)
        $adUser = Get-ADUser $spUSer
        $ErrorMessage = $_.Exception.Message

foreach($not in $notAd.ToArray())
Write-Host $not
  • Jorge is working with the server side API in his code. Using REST would mean a complete code rewrite. Besides, working with JSON and XML isn't everyone's cup of tea. :-) Mar 16, 2017 at 10:52
  • Correct, but he mentioned wanting a different way of doing it. Not every company/client likes giving shell access to other accounts. Mar 16, 2017 at 13:18
  • Agreed eHaze. Nice update to your post. Mar 17, 2017 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.