Montoya
asked on
Get user profiles from SharePoint 2010 and put in Excel
Trying to get a list of user profiles from SharePoint 2010.
Ive already tried script at https://onedrive.live.com/?cid=5593AB40F8C855AD&id=5593AB40F8C855AD%213364
and got errors, so I need a different Powershell script or other method to get all existing profiles, preferably into a CSV so I can put in Excel.
Ive already tried script at https://onedrive.live.com/?cid=5593AB40F8C855AD&id=5593AB40F8C855AD%213364
and got errors, so I need a different Powershell script or other method to get all existing profiles, preferably into a CSV so I can put in Excel.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this script errors out for me..
PS C:\Powershell> .\allusers2
New-Object : Exception calling ".ctor" with "1" argument(s): "Object reference
not set to an instance of an object."
At C:\Powershell\allusers2.ps 1:7 char:29
+ $profileManager = New-Object <<<< Microsoft.Office.Server.Us erProfiles .UserP
rofileManager($serviceCont ext);
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowExc eption,Mic rosoft.Pow er
Shell.Commands.NewObjectCo mmand
You cannot call a method on a null-valued expression.
At C:\Powershell\allusers2.ps 1:8 char:42
+ $profiles = $profileManager.GetEnumera tor <<<< ()
+ CategoryInfo : InvalidOperation: (GetEnumerator:String) [], Run
timeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exporting profiles
Cannot index into a null array.
At C:\Powershell\allusers2.ps 1:16 char:40
+ $profileData.AccountName = $profile[ <<<< "AccountName"].Value
+ CategoryInfo : InvalidOperation: (AccountName:String) [], Runti
meException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps 1:17 char:38
+ $profileData.FirstName = $profile[ <<<< "FirstName"].Value
+ CategoryInfo : InvalidOperation: (FirstName:String) [], Runtime
Exception
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps 1:18 char:37
+ $profileData.LastName = $profile[ <<<< "LastName"].Value
+ CategoryInfo : InvalidOperation: (LastName:String) [], RuntimeE
xception
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps 1:19 char:42
+ $profileData.PreferredName = $profile[ <<<< "PreferredName"].Value
+ CategoryInfo : InvalidOperation: (PreferredName:String) [], Run
timeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps 1:20 char:38
+ $profileData.WorkPhone = $profile[ <<<< "WorkPhone"].Value
+ CategoryInfo : InvalidOperation: (WorkPhone:String) [], Runtime
Exception
+ FullyQualifiedErrorId : NullArray
PS C:\Powershell>
PS C:\Powershell> .\allusers2
New-Object : Exception calling ".ctor" with "1" argument(s): "Object reference
not set to an instance of an object."
At C:\Powershell\allusers2.ps
+ $profileManager = New-Object <<<< Microsoft.Office.Server.Us
rofileManager($serviceCont
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowExc
Shell.Commands.NewObjectCo
You cannot call a method on a null-valued expression.
At C:\Powershell\allusers2.ps
+ $profiles = $profileManager.GetEnumera
+ CategoryInfo : InvalidOperation: (GetEnumerator:String) [], Run
timeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exporting profiles
Cannot index into a null array.
At C:\Powershell\allusers2.ps
+ $profileData.AccountName = $profile[ <<<< "AccountName"].Value
+ CategoryInfo : InvalidOperation: (AccountName:String) [], Runti
meException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps
+ $profileData.FirstName = $profile[ <<<< "FirstName"].Value
+ CategoryInfo : InvalidOperation: (FirstName:String) [], Runtime
Exception
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps
+ $profileData.LastName = $profile[ <<<< "LastName"].Value
+ CategoryInfo : InvalidOperation: (LastName:String) [], RuntimeE
xception
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps
+ $profileData.PreferredName
+ CategoryInfo : InvalidOperation: (PreferredName:String) [], Run
timeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Powershell\allusers2.ps
+ $profileData.WorkPhone = $profile[ <<<< "WorkPhone"].Value
+ CategoryInfo : InvalidOperation: (WorkPhone:String) [], Runtime
Exception
+ FullyQualifiedErrorId : NullArray
PS C:\Powershell>
ASKER
I also need to get the user's Title, please.
Thank you for your efforts.
Thank you for your efforts.
ASKER
Any suggestions, Layaraja?
yes this is a powershell script .
quick check on the script.....
1. did you run under admin account (farm admin)?
2.Did you change the site collection url ?
and for the ctor error refer here http://blogs.catapultsystems.com/rhutton/archive/2012/10/11/updating-a-user-profile-picture-using-powershell-exception-calling-quote-ctor-quote-with-quote-1-quote-argument.aspx
for title..change it to
$profileData = "" | select "AccountName","FirstName", "LastName","PreferredName" ,"WorkPhon e","Title"
and add one more line
$profileData.Title= $profile["Title"].Value
quick check on the script.....
1. did you run under admin account (farm admin)?
2.Did you change the site collection url ?
and for the ctor error refer here http://blogs.catapultsystems.com/rhutton/archive/2012/10/11/updating-a-user-profile-picture-using-powershell-exception-calling-quote-ctor-quote-with-quote-1-quote-argument.aspx
for title..change it to
$profileData = "" | select "AccountName","FirstName",
and add one more line
$profileData.Title= $profile["Title"].Value
ASKER