SharePoint 2010 Central Admin to add users from AD from specific Department

Dear All,
I am working on SharePoint Foundation 2010. I have to add users from specific department to a particular site collection.
Please let me know if there is a way to import users from Active Directory based on the 'Department' filed in
SPCA.
Thanks.

Is that okay if I share the PowerShell code? Do you have access to Active Directory and can you query information?
Refer this Link
Code
# set site collection owner for all sites...
# 1-2012
Add-PSSnapin Microsoft.SharePoint.PowerShell
# $AccountList is an array of Windows Identities in the format of $AccountList = @("DOMAIN\USERID" , "DOMAIN\USERID2")
$accountList = @(Get-ADUser -Filter {(Department -like '*Ur Needs*')})
#$AccountList = @("LAB\Jack", "Lab\tom", "Lab\dick", "lab\harry")
#this gets an array of objects representing the sites at the IIS level:
$IISSites = Get-SPWebApplication
Foreach($oneIISSite in $IISSites)
#using .Sites, we can get a list of the site collections
foreach ($SharepointSiteCollection in $oneIISSite.Sites)
write-host $SharepointSiteCollection.url -ForegroundColor Cyan
$spweb = Get-SPWeb $SharepointSiteCollection.url
#now we have the website, so lets look at each account in our array
foreach ($Account in $AccountList.samaccountname)
#lets see if the user already exists
Write-host "Looking to see if User " $account " is a member on " $SharepointSiteCollection.url -foregroundcolor Blue
$user = Get-SPUSER -identity $Account -web $SharepointSiteCollection.url -ErrorAction SilentlyContinue #This will throw an error if the user does not exist
if ($user -eq $null)
#if the user did NOT exist, then we will add them here.
$SPWeb.ALLUsers.ADD($Account, "", "", "Added by AdminScript")
$user = Get-SPUSER -identity $Account -web $SharepointSiteCollection.url
Write-host "Added user $Account to URL $SPWeb.URL" -Foregroundcolor Magenta
else
Write-host "user $Account was already in URL " $SPWeb.URL -Foregroundcolor DarkGreen
if ($user.IsSiteAdmin -ne $true)
$user.IsSiteAdmin = $true
$user.Update()
Write-host "$account has been made an admin on $SPWeb.URL" -Foregroundcolor Magenta
else
Write-host "$account was already an admin on $SPWeb.URL" -Foregroundcolor DarkGreen
$SharePointSiteCollection.Dispose()
Note:
First uncomment the second $accountlist add the user manually to test
If you have AD module installed in your SP server you can use
$accountList = @(Get-ADUser -Filter {(Department -like '*Ur Needs*')})
Regards Chen V [MCTS SharePoint 2010]

Similar Messages

  • When attempting to create an SSRS Report in SharePoint 2010 Dashboard Designer and change the Server Mode from Report Center to SharePoint Integrated

    Hi,
    When attempting to create an SSRS Report in SharePoint 2010 Dashboard Designer and change the Server Mode from Report Center to SharePoint Integrated, I get the following unhandled exception:
    ************** Exception Text **************
    System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Instance validation error: '2' is not a valid value for Microsoft.PerformancePoint.Scorecards.SqlReportViewData.SqlReportViewDataServerMode.
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSqlReportViewData.Write1_SqlReportViewDataServerMode(SqlReportViewDataServerMode v)
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSqlReportViewData.Write3_SqlReportViewData(String n, String ns, SqlReportViewData o, Boolean isNullable, Boolean needType)
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSqlReportViewData.Write4_SqlReportViewData(Object o)
       --- End of inner exception stack trace ---

    Hi,
    According to your post, an error occurred when you integrate SQL Server Reporting Services with SharePoint.
    1. Please check the steps as the link below:
    http://technet.microsoft.com/en-us/library/ff724283(v=office.14).aspx
    2. Try to clean the configuration cache on all of your SharePoint servers and re-tested.
    http://blogs.msdn.com/b/josrod/archive/2007/12/12/clear-the-sharepoint-configuration-cache-for-timer-job-and-psconfig-errors.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Question on Location for SharePoint 2010 Central Administration Console

    I am a SQL Server Database Administrator and I am new to SharePoint 2010.  I have been asked to find out what the best practice is for the SharePoint 2010 Central Administration console.  Should it be on the application server or should it be
    on it's own server?
    lcerni

    Hi Icerni,
    As Scott suggested, by default, the server that hosts Central Administration in a three-tier farm is an application server.
    You might be interested in server role:
    http://blogs.technet.com/b/wbaer/archive/2009/12/06/configuring-the-web-and-application-server-roles-for-microsoft-sharepoint-server-and-foundation-2010.aspx
    http://technet.microsoft.com/en-us/library/cc261752(v=office.15).aspx
    In addition, here is a list of articles for best practice in SharePoint 2010:
    http://technet.microsoft.com/en-us/library/cc850682(v=office.14).aspx
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Org Tech Admin can add user from other org?

    We are currently on a trial run with CIAC, and I am testing User Management with a Organization Tech Admin account (OTA).
    To my suprise, when adding user and select "existing user", I can see every account currently on Cloud Portal, and even successfully add user from other organization to my orgnization.
    Is there anyway so that OTA can see only the users in their own organization?

    I've been able to remove the admin role from a site administrator with an OTA.
    I know there are issues when you log with an user then logout and relog with another user, CIAC considers that you are still the previous user (I've encountered the issue several times in portlets in the nsapi requests). I don't know if/how those issues are related, but I'd say that logout/login issue were an user has the same rights than the previous users should be fixed.
    Changing OTA rights will not change that particular issue.
    For the moment, what we've done is create our own servlet for requests to the sql DB, and our own roles for most services.
    Let's see what v4 has in store for us.

  • SharePoint 2010 UI Interface to add Custom Property for a Term, similar to SharePoint 2013 .

    Hi All,
    We have a requirement to capture additional metadata for each Term (Ex: Requested for, Requested date, Requested by). these properties are not available in Sharepoint 2010 OOTB but can be acheived using Term.SetCustomProperty(). where as in SharePoint 2013,we
    have option to add/update/delete custom Properties in Term Store management window(Custom propertiesTabs) , which is OOTB. 
    Just want to understand is  there any way to get that Custom Property Tab interface in 2010. Or any other way to manage(Add/Update/delete) custom properties from the browser itself. 
    Is there any codeplex/other solution which will  allow us to manage properties from browser with out doing the code.
    Any suggestions on this would be helpful
    Thanks in advance
    ragava_28

    Hi,
    According to your description, you want to manage term custom property in SharePoint 2010.
    As you know, there is no OOTB method to meet your requirement.
    If you want to do it without coding, you can take a look at this tool about managing term store:
    http://www.metavistech.com/product/term-store-manager
    As this is a third party tool, we are not sure whether it has risks, please use with caution.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Group Admin can add user to group but can't update user account in SAM SDK

    Hi
    I have created a user X and Group Y, and I have assigned the created Group Y Admin Role to user X and made user X a member of Group Y.
    Now User X can create users but can't see them when doing a search.
    Also if using the SDK this user attempt to add a user he created as a member of Group Y the LDAP return an error that user X dosen't have enough permissions to update the membership attribute of the new user account that he created.
    Funny enough looking in the LDAP, the user is actually added as a member of the Group.
    So the Group was updated correctly but the suer account is not.
    Does anybody now a fix for this issue or is it fixed in any patches to SAM 7.1

    Hi,
    Did the issue happen only for you or for multiple users?
    Please login on other well worked Lync client from other computer with your Lync account to test the issue.
    Please also use another well worked Lync account login your Lync client and test the issue.
    You can disable your Lync account from Lync Server Control Panel and clear all SIP related information from AD, then re-enable your Lync account from Lync Server Control Panel to have a try.
    Here is a similar case may help you:
    http://social.technet.microsoft.com/Forums/lync/en-US/09032674-3927-4898-8f93-f3e6f3eab540/lync-2013-cannot-add-remove-or-move-contacts-or-groups-at-this-time?forum=lyncprofile
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • SharePoint 2010 and Reporting Services add-in - multiple versions supported?

    Hello,
    I would like to try out Reporting Services with SharePoint 2010.  I already have the Reporting Services add-in installed on the WFE for SQL Server 2008 R2, but not configured. 
    At this point I thinking it's best to move forward with SQL Server 2012.
    Can both the 2008 R2 version and 2012 version of the Reporting Services add-in exist on the same WFE in separate instances? Or do I need to uninstall the 2008 R2 version first?    
    Thank you in advance,

    Just upgrade to the 2012 version, you don't have to uninstall first.
    Also, see the supported combinations of SSRS version and Addin version:
    http://msdn.microsoft.com/en-us/library/gg492257.aspx
    Use the highest version of the addin possible, as newer addins have offered performance improvements.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Content Database Status Error in SharePoint 2010 Central Administration

    Hi,
    I am having a new problem with SharePoint 2010 on Windows Server 2008 R2. I have SQL Server 2008 R2 as SharePoint Database on Windows Server 2008 R2. I have total no. of
    Seven Content Databases for one Web Application. I found
    two of my Content Databases showing Error under the
    Database Status column in Manage Content Database section in
    Central Administration. Five Content Databases are showing
    Started.
    Would someone please guide how to resolve it and whats wrong is going on? 
    Thanks in advance.

    What is the output of:
    $db = Get-SPContentDatabase <error'ed db name>
    $db.Status
    And can you set it to Started?
    $db = Get-SPContentDatabase <error'ed db name>
    $db.Status = "Online"
    $db.Update()
    Trevor Seward, MCC
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • SharePoint 2013 Central Admin says port 80 for three web applications, but IIS says they have different ports

    Hello,
    I have three web applications on a SharePoint 2013 servers.  In Central Administrators on the Application Management page where it lists all of the web applications, it shows Port 80 being used 2 3 sites.  When I go to IIS, 2 of the 3 are using
    different ports, 81 and 82.  So, only one site IIS says is using port 80. Why is this?  The host file has no entries in it.  Where these web applications extended?
    Thanks,
    Paul
    Paul

    Hi Paul,
    From the URL of the web application in Central Administration in the image, you have configured the Alternate Access Mapping for the web applications.
    And the URL configured is by default using port 80 if you don’t 
    assign other ports for the web application, so the port is changed to 80 in Central Administration.
    To be able to access the web application, you need to add binging for the web application in IIS(please make sure that you have added the host name in DNS).
    For example, SharePoint – 32298, you need to create the binding for the web application in IIS as the image below:
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • SP 2010- Central Admin showing error while FBA configuration....

    Hi Experts, 
    I am trying to configure my sharepoint website using form based authentication . After completing some steps I added following things to SharePoint admin Web.Config file.
    - Membership
    - Role Manager
    - <add key="FBA" value="%" /> in PeoplePickerWildcards
    But After Adding the ROLEMANAGER section I am getting error. If I removed the section it is ok.
    Can experts help me to solve the error.
    AshisK

    OK.
    Did you add your connection string in the web.config?
    In the same web.config you are also supposed to add your ESISPBOX FBA DB connection string. Something like this.
    <connectionStrings>
    <clear/>
    <add name="ESISPBOX FBA DB"
    connectionString="data source=SPSQL; Integrated Security=SSPI;Initial Catalog=aspnetdb;"
    providerName="System.Data.SqlClient" />
    </connectionStrings>
    Amit

  • Workflow SharePoint 2010 -Approval workflow for multiple users

    Want to create a 2010 SharePoint server workflow which will allow me to send email once item is added > Start approval process > if approved then mark workflow status as approved and then send email to reviewer 2 and again start the process of approving
    > and approved then again mark status to approved and send email to reviewer 3 and mark status to approved if approved by reviewer 2 and end the workflow.Also, if the item is not approved by any user, then it should directly log a comment and go to end
    of the workflow.
    I had started as something like :
    Send Email to rev1
    Start approval process for current item with rev1
    if approval status is approved
    set workflow status to approved
    send email to rev2 and so on...everything works but when rev1 rejects the item, then workflow does not go to end of the workflow. One difficult thing is we don't have go to a step option like in 2013 workflows.
    I don't know how to move on as when I try to execute the logic, all three approval process(for 3 reviewers) run even if item is rejected .....Please help

    Check these links
    https://slingeronline.wordpress.com/2013/02/27/setting-cancel-on-first-rejection-on-an-spd-workflow/
    http://sharepointduffbert.com/2014/06/17/getting-an-spd-approval-workflow-to-cancel-on-rejection-or-change/
    https://social.msdn.microsoft.com/Forums/office/en-US/c212e5d7-f7bf-4f17-be16-374e02652dbb/reject-stop-workflow-not-working?forum=sharepointcustomizationprevious
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/a2d0a259-f8ca-48cf-b9ab-0c9387329502/sharepoint-designer-workflow-how-to-jump-back-to-previous-workflow-step?forum=sharepointcustomizationprevious
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Add user in LDAP from IDM

    Hi,
    creating a user from IDM on LDAP have the following error: "com.waveset.util.WavesetException: An error occurred adding user 'cn=pippo,ou=ac_bu,dc=atlan,dc=it' to resource 'LDAP'. javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - Entry cn=pippo,ou=ac_bu,dc=atlan,dc=it violates the Directory Server schema configuration because it is missing attribute sn which is required by objectclass person] ", the 'sn' attribute, that is required, is not send.
    How do I send the attribute 'sn' and give 'sn' value 'lastname' ?
    Thank for you time.

    In attribute mappings map lastname(in IDM side) with sn(in LDAP side).

  • How to add new database server instance in Sharepoint 2010?

    I have installed SQL server 2012 BI edition and I have been trying to add new SQL Server reporting services in Sharepoint 2010 central admin .But When I click "ok "after giving the new SQL server name in the SQL Server reporting service creating
    process, I get an error stating "This user does not have permission on the SQL server".Though ,I have given this user dbcreator role on that particular database instance.Could you please help me out?

    Does the initial installation account used to set-up the farm have these permissions on the database?
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Trying to link SharePoint 2010 Enterprise with SharePoint 2013 Search Server raises error

    Hi,
    I am currently working for a multinational who has SharePoint 2010 Enterprise Edition installed, 2 WFE SERVERS, 3 APP SERVERS, 1 DB SERVER. They also installed SharePoint 2013 Exterprise recently.
       Microsoft have recently come in and set up the SharePoint 2013 Search Server to crawl content in SharePoint 2010 as the replacement search to SharePoint 2010 Search. So they have gone through process of certificates and permissions
    setups I guess. I was told it was working, but recently failed. When I type in the search box on a web site for SharePoint 2010 I get the message:
             The search request was unable to connect to the Search Service.
    I checked the Event log and the Critical error (in Task Category:Timer) I get is the notorious: 
    The Execute method of job definition Microsoft.Office.Server.Search.Administration.CrawlReportJobDefinition (ID fa882704-80d9-415b-9b9d-eae5e9bdefd4) threw an exception. More information is included below.
            The search service is not able to connect to the machine that hosts the administration   
            component. Verify that the administration component 'e9172a05-22ec-4904-9508-
            e5431a180c2b' in search application 'Search_Service_Application' is in a good state and
            try again.
    I know administration component is the crawler. I am assuming this is permissions.
    The SharePoint 2013 Search Server is picking up SharePoint 2010 site collections items fine i.e. The SharePoint 2013 search shows items from 2010 as expected.  
    On the SharePoint 2010 central admin box the search service enabled and running (checked with powershell). (SharePoint Server Search 14)
    The Search Service id: e9172a05-22ec-4904-9508-e5432a180c2b
    I also get the message in event log for gatherer on SharePoint 2010 CA and Search Server:
           Could not access the Search database. A generic error occurred while trying to access the database to obtain   
           the schema version info.
           Context: Application 'e9172a05-22ec-4904-9508-e5431a180c2b'
    Details:
                (0x80040e09)
    Is this permissions to delete something from crawler??????
    I would appreciate if someone could help on this. I have tried to be as concise as possible.
    Thanks.
    John.

    It was a case that someone had fiddled with the Service App Associations. Hadn't ticked SharePoint 2013 search. Was still point at 2010. Thanks.
    The SharePoint 2013 Search works correctly for SharePoint 2010.
    Can someone confirm that the Search Service Application on SharePoint 2010 still needs to exist and hence SharePoint Server Search 14 Service still needs to be running? I am guessing it would as you search from 2010 interface not 2013. I am getting a critical
    error in the Event Viewer:
    CrawlReportJobDefinition (Id <SharePoint 2010 Crawler>) 
    The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component <crawler id> in search application "Search Service Application" is in a good state and try
    again.
    I think this is related to the fact we have SharePoint 2013 doing the search instead of 2010.
    Any ideas?
    John.

  • How to find out Db name of perticular web application in sharepoint 2010

    how to find out Db name of perticular web application in sharepoint 2010 to take a backup from sql

    1.  Open the SharePoint 2010 Central Admin application.
    2.  On the SharePoint central administration website, click Application Management.
    3.  In the Databases section, click Manage Content Databases.
    4.  On the Manage Content Databases page, select a web application by clicking the Web Applications drop-down list and choosing a web application.
    5.  Can notice the  available database names for the webapplication. ******************************************************************************************
    Please remember to mark your question as answered &Vote helpful, if this solves/helps your problem
    s p kumar

Maybe you are looking for

  • I insert a wrong email..what can I do to change ??

    I insert a wrong email in my icloud..what can I do to insert a correct mail?

  • Trading partner automatically populated for document type KP

    Hi All, We have two vendor A & B.  In vendor A master data we have trading partner maintained & in Vendor B trading partner field is blank. Now when we execute transaction MR11(GR/IR clearing) then trading partner is populated to both the vendor. Whi

  • Website not centred in firefox ?

    just downloaded firefox and everything worked fine in internet explorer, but in firefox the website is not centred to the page ? www.mob-jukeboxes.com

  • Are blackberries like nokia smartphones??

    Hi im a new user to blackberry devices. I just bought a 8900 2weeks ago and previously i was using E71. E71 pretty much cater to all my needs Email, Msn. However for my 8900, i cant use both of that which i've mentioned so i went to my carrier and th

  • Mac Mail "Search" won't return any results

    Hi, Mac Mail- OS X Yosemite 10.10.2 I'm having trouble with the search feature on my Mac Mail. I'm using an IMAP account with: Inbox, Drafts, Sent, Junk and trash mailboxes. I also have folders under the "On My Mac" section. When I click on a folder,