I'm trying to import and sync AD users with SharePoint Foundation but keep running into null errors. The results of my script run with psbreakpoint in ISE are immediately below. The script is based on the ones posted at http://community.spiceworks.com/topic/210127-populate-active-directory-user-information-in-sharepoint-foundation, which I ran with similar errors.
What am I doing wrong?
#Load The Active Directory Module
# Retrieve the Get-ADUser cmdlet to your Session
# Add SharePoint.PowerShell Snapin
# Retrieve Specific Web –
$spList = $spWeb.Lists["Test"]
# Get All Users and Create a new ListItem foreach user.
Get-ADUser -filter * -Properties SAMAccountName -SearchBase 'OU=PHS,DC=peninsulahumane,DC=com' |
set-psbreakpoint -Variable item -mode read
ModuleType Name ExportedCommands
Cannot index into a null array.
You cannot call a method on a null-valued expression.
According to the errors, it looks like $splist is null. I'd try interactively running the get-spweb part and seeing what you get back from $spweb.Lists.
You must be logged in to reply to this topic.