Validate if username exits in Active Directory

Hi,
What I want to do is simply validate if a given String username is within ActiveDirectory.
I can already authenticate if I have a username and password with the following code:
Context ctx = null;
Hashtable env = new Hashtable ();
boolean isValid = false;
try {
     //set the name of domain with the user name
     String fullName = userName + "@" + "mycompany.com";
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap
env.put(Context.PROVIDER_URL,"ldap://mycompany.com:389");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
     //set user related information
     env.put(Context.SECURITY_PRINCIPAL, fullName);
     //set user password
     env.put(Context.SECURITY_CREDENTIALS, "password");
     //validate user
     ctx = new InitialDirContext(env);
     isValid = true;
     System.out.println("IS GOOD isValid is: " + isValid);
     catch (AuthenticationException ex)
     System.out.println("AuthenticationException is: " + ex);
     isValid = false;                              
     catch (NamingException ex)
     System.out.println("NamingException is: " + ex);
But again, I don't want to authenticate with a username and password - I just want to see if a given username is a valid username withing Active Directory - (I've taken out the
env.put(Context.SECURITY_CREDENTIALS, "password"); in the above code and that does not work) so I am sure I need some sort of different approach. Code samples would be greatly appreciated.
Many Thanks

hi.
how did you manage to authenticate a username and password on AD? i am using simlar code to you but to no avail. do you need to get a ticket from the KDC first? if so how?
the KDC is part of the AD so i would assume you just need to pass a user and pass to the same domain that AD is on.
is there any other way of authenticating a username and password on AD without going through kerberos?
any ideas what im doing wrong?
thanks,
john.

Similar Messages

  • Windows Active Directory Authentication

    Hi Experts,
    I have an enterprise application running in a clustered environment. The jars are diployed in jboss and wars in tomcat servers. The requirement is to authenticate users with thier Windows username/password with active directory itself and depending upon their roles give access to various functionalities in the application. Could someone guide on how the windows authentication should be done?
    Thanks

    We were able to successfully enable the Windows AD Authentication.
    Section 4 would be on the SIA's or server tier. Sections 5,6,and 7 would be for the Java Web app server or web tier.
    We got an error when trying to enable SSO though.
    The server encountered an internal error (com.wedgetail.idm.sso.ProtocolException: com.wedgetail.idm.spnego.server.SpnegoException: GSSException: Failure unspecified at GSS-API level (Mechanism level: com.dstc.security.kerberos.KerberosException: Successfully matched service principal "account@domian_name" but not key type (18) + KVNO (32) in this entry: Principal: [1] account@domain_name TimeStamp: Wed Dec 31 19:00:00 COT 1969 KVNO: -1 EncType: 23 Key: 16 bytes, fingerprint = [......] )) that prevented it from fulfilling this request.
    We disabled the SSO for the time being, but the Windows AD works fine.

  • Active Directory error message "the following object is not from a domain listed in the Select location forestB\username

    Hello Community
        "forestA" is my forest it is a Windows 2008 Server Enterprise Edition
    domain controller using Active Directory and the UI.
        In my forest ("forestA") trust relationship I created a "One-Way, Out-going"
    forest trust with Forest-Wide authentication so that a different forest user(s) or
    group(s) with a different admin in a forest named “forestB” can access the resources in my “forestA”
        But also forestB needs to create a "One-way, Incoming" forest trust so that
    I can either add the user(s) or group(s) from “forestB” into to a "Global Security - Group"
    in my "forestA" or I can
     add user(s)  as  "domain user(s)" from “forestB” into my "forestA".
        The problem is that when I right click  the global group in my forestA  and then
    properties, when I click "Members" and then the "Add" button when I type
    "forestB\username" I get an error message from Active Directory stating:
        "the following object is not from a domain listed in the Select location
    dialog box, and is therefore not valid: forestB\username".
        Am I doing something wrong when creating the one-way trust in my
    “forestA” or is the one-way trust being created wrong by the other domain admin in the other “forestB”?
        Or could I possibly need to select "Change Domain" or "Change Domain Controller"
    before adding the users or Groups to my forestA from forestB?
        That is why I am asking
     how do you add an Active Directory user from one forest into another forest?
        Thank you
        Shabeaut

    Hello Denis Cooper
        That is the end result.
        What I was trying  to do was that I was trying to
     bring in the user(s) and group(s) from “forestB”  into
    my “forestA”  Global group.
        Later on I was going to add the user(s) or Global groups(s) that I brought into my dc in my forestA
     into the domain local groups  on my member servers in my forestA.
        So since the error message is:
    "the following object is not from a domain listed in the Select location dialog box, and is therefore not valid: forestB\username".
    Does your response
     mean only Global group(s) from forestB not domain user(s) from forestB have
     to been added to domain local groups in forestA?
    Or is it also possible to add Global group(s) from “forestB” to Global group(s) in my “forestA” and if so
    how without getting the above error message?
    Thank you
        Shabeaut

  • ISE : Active Directory integration long usernames sAMAccountname

    Have a customer deploying ISE for wireless authentication using PEAP-MSCHAPv2.  They've encountered an issue where some users with long usernames are failing authentication to ISE.  ISE logs that the user is not found in the user database (Active Directory).
    Upon further review, it appears that ISE is using the sAMAccountname as the username token to authenticate against.
    sAMAccountname is limited to 20 characters. 
    Customer is running a full Windows 2008 domain and users login to the domain using their User Principal Name (no 20 character limit).  Therefore, when the user creates a wireless connection and passes his Windows credentials to PEAP, it fails because the username is too long and ISE does not find user in AD database.
    Is there a way to point ISE to use a different username token instead of sAMAccountname?  or is this a known issue?

    I don't think there is any way to increase the limit of 20 characters. You have to create to user name with 20 characters limit.

  • How to Uninstall SQL instance on active-passive SQL server , which failed during Cluster Setup (Error-Failed at Validate Active Directory Configuration)

    How to Uninstall SQL instance on active-passive SQL server , which failed during Cluster Setup (Error-Failed at Validate Active Directory Configuration)
    active-passive SQL server cluster setup failed due to some steps missed in initial cluster setup,
    now i have unistall sql instance from nodes,
    Your help will higly appriciated.
    Regards,
    Anish
    Asandeen

    Hello,
    Please refer to the following link about remove a node of  SQL Server Failover Cluster Instance:
    http://msdn.microsoft.com/en-us/library/ms191545.aspx#Remove
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Copy usernames and file permissions from old workgroup to new Active Directory

    Hi,
    I have a Windows Server 2003 R2 with about 60 users, 100 shared folders and 5000 subfolders. Each folder has share and protection permissions. Each subfolder has protection permissions. No active directory.
    I need to install Windows Server 2012 R2 (as Primary Domain Controller) and re-create
    the same users (which can have different guid but with the same username as the old server)
    the same shared folders, with the same permission as the old server granted to the users
    the same subfolders, with the same permission as the old server granted to the users
     all under Active Directory.
    Is there a way to automate these steps?
    Thanks!

    Look in script repository for scripts that export local users and groups.
    You will have to learn how these two systems work and develop a script / method for translating between the two systems.  It is very dependent on what has been don on old system.  Using USMT and MDT would be the best. 
    Post in the deployment forum for instructions on how to use the MDT to migrate users in a batch.  You would start by adding the 2003 server to the 2012 domain and then the MDT can be customized to do the move.
    https://technet.microsoft.com/en-us/windows/dn475741.aspx?f=255&MSPPError=-2147217396
    https://social.technet.microsoft.com/Forums/en-US/home?forum=mdt
    ¯\_(ツ)_/¯

  • Does one of the Lync SQL databases store the active directory username or SID of the person who made a call ?

    I am trying to write a report that uses data from Lync (2010), Active directory (AD) and other databases.
    I need to match data from Lync with records in active directory.
    When you make/recieve a call, the session details has a userid column - a foreign key to the users table, which has the UserURI - the users emails adddress or telephone number.
    However, trying to mach the data, I have noticed that someones email address can change so that what is in active directory does not match that used as the SIPaddress in Lync.
    I need a field that matches in Active directory and Lync to be able to link a users call records with their active directroy records.
    I was wondering how Lync decides which Lync user you are when it auto logins you in.
    Does it do it on the basis of your phone number, AD username or something else ?
    If so , where in Lync does it store the mapping from whatever it uses to your Lync userid ?
    Greg

    The msrtcsip-primaryuseraddress attribute in AD is where the users SIP address is stored.
    This can change still, but generally that should not be very often except maybe a name change or domain name change.
    Almost everything in Lync is based on the SIP address. In CDR's case, it is just recording SIP messages as they pass through the front end; it has no visibility into the actual AD account that sent it.
    If you will need to match user SIP addresses back to live AD accounts, even after a SIP address change, then I would recommend setting up a custom AD attribute to store their SIP account history and have a policy to update that attribute each time someone's
    SIP address gets changed.

  • Handling Case where Same username in Workgroup Mgr & Active Directory

    Does anybody know how to handle this situation?
    We might have the same username local to the Mac Workgroup, but also existing in AD. The Leopard server is bound to AD and also uses AD groups as ACLs for AFP shares. We want people to use AD credentials to access this AFP, but want to be covered in situations where the user has an account in workgroup manager. Can Leopard be configured such that if the authentication to local workgroup fails because the user has entered AD password, it tries active directory next?
    thnx!

    Back in the day I had thin clients that had hard coded RDP connections to a terminal server host.
    Each thin client could logon by itself, in which case there was one common session per client, or I could force each user to logon individually.
    Again, it all depends on what you are looking for.
    I got the impression from your question that you are simply using the Virtual Center client to authenticate users and the VM that they get access to, then delivering a console.
    Unless there is a different objective.
    I don't think we really understand what you are looking for.
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

  • How to authenticate Username and password in MVC using Azure Active Directory

    Need a sample application where in need to authenticate user entered logindetails using Azure Active directory.

    Hi,
    Kindly go through beneath article which helpful to understand the procedure.
    How to Authenticate Web Users with Azure Active Directory Access Control
    http://azure.microsoft.com/en-in/documentation/articles/active-directory-dotnet-how-to-use-access-control/
    Developing ASP.NET Apps with Windows Azure Active Directory
    http://www.asp.net/identity/overview/getting-started/developing-aspnet-apps-with-windows-azure-active-directory
    Adding Sign-On to Your Web Application Using Azure AD
    https://msdn.microsoft.com/en-us/library/azure/dn151790.aspx
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Active Directory Web Services service terminated unexpectedly

    Hi everyone:
    I'm having a problem with the Active Directory Web Services service does not start. Attach the event ID:
    Log System:
    Log Name: System
    Source: Service Control Manager
    Date: 1/6/2015 6:55:19 PM
    Event ID: 7034
    Task Category: None
    Level: Error
    Keywords: Classic
    User: N/A
    Computer: xxx.dominio.com
    Description:
    The Active Directory Web Services service terminated unexpectedly. It has done this 35 time(s).
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" />
    <EventID Qualifiers="49152">7034</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8080000000000000</Keywords>
    <TimeCreated SystemTime="2015-01-06T22:55:19.292471600Z" />
    <EventRecordID>32583</EventRecordID>
    <Correlation />
    <Execution ProcessID="556" ThreadID="1388" />
    <Channel>System</Channel>
    <Computer>xxx.dominio.com</Computer>
    <Security />
    </System>
    <EventData>
    <Data Name="param1">Active Directory Web Services</Data>
    <Data Name="param2">35</Data>
    <Binary>41004400570053000000</Binary>
    </EventData>
    </Event>
    Log Application:
    Log Name: Application
    Source: .NET Runtime
    Date: 1/6/2015 6:55:13 PM
    Event ID: 1026
    Task Category: None
    Level: Error
    Keywords: Classic
    User: N/A
    Computer: xxx.dominio.com
    Description:
    Application: Microsoft.ActiveDirectory.WebServices.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.ServiceModel.CommunicationObjectFaultedException
    Stack:
    at System.ServiceModel.Channels.CommunicationObject.Close(System.TimeSpan)
    at Microsoft.ActiveDirectory.WebServices.WindowsHostService.StartService(System.Object)
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    at System.Threading.ThreadHelper.ThreadStart(System.Object)
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name=".NET Runtime" />
    <EventID Qualifiers="0">1026</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-01-06T22:55:13.000000000Z" />
    <EventRecordID>1661713</EventRecordID>
    <Channel>Application</Channel>
    <Computer>xxx.dominio.com</Computer>
    <Security />
    </System>
    <EventData>
    <Data>Application: Microsoft.ActiveDirectory.WebServices.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.ServiceModel.CommunicationObjectFaultedException
    Stack:
    at System.ServiceModel.Channels.CommunicationObject.Close(System.TimeSpan)
    at Microsoft.ActiveDirectory.WebServices.WindowsHostService.StartService(System.Object)
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    at System.Threading.ThreadHelper.ThreadStart(System.Object)
    </Data>
    </EventData>
    </Event>
    And
    Log Name: Application
    Source: Application Error
    Date: 1/6/2015 6:55:13 PM
    Event ID: 1000
    Task Category: (100)
    Level: Error
    Keywords: Classic
    User: N/A
    Computer: xxx.dominio.com
    Description:
    Faulting application name: Microsoft.ActiveDirectory.WebServices.exe, version: 6.2.9200.16579, time stamp: 0x516356a2
    Faulting module name: KERNELBASE.dll, version: 6.2.9200.16864, time stamp: 0x531d34d8
    Exception code: 0xe0434352
    Fault offset: 0x0000000000047b8c
    Faulting process id: 0x4ac
    Faulting application start time: 0x01d02a03d45e2d00
    Faulting application path: C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe
    Faulting module path: C:\Windows\system32\KERNELBASE.dll
    Report Id: 1273a0f1-95f7-11e4-93f7-3440b59e2092
    Faulting package full name:
    Faulting package-relative application ID:
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Level>2</Level>
    <Task>100</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-01-06T22:55:13.000000000Z" />
    <EventRecordID>1661714</EventRecordID>
    <Channel>Application</Channel>
    <Computer>xxx.dominio.com</Computer>
    <Security />
    </System>
    <EventData>
    <Data>Microsoft.ActiveDirectory.WebServices.exe</Data>
    <Data>6.2.9200.16579</Data>
    <Data>516356a2</Data>
    <Data>KERNELBASE.dll</Data>
    <Data>6.2.9200.16864</Data>
    <Data>531d34d8</Data>
    <Data>e0434352</Data>
    <Data>0000000000047b8c</Data>
    <Data>4ac</Data>
    <Data>01d02a03d45e2d00</Data>
    <Data>C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe</Data>
    <Data>C:\Windows\system32\KERNELBASE.dll</Data>
    <Data>1273a0f1-95f7-11e4-93f7-3440b59e2092</Data>
    <Data>
    </Data>
    <Data>
    </Data>
    </EventData>
    </Event>
    I was working about this solution but nothing. "http://blogs.microsoft.co.il/yuval14/2012/06/08/how-to-resolve-error-message-the-active-directory-web-services-service-terminated-unexpectedly-event-id-4079-andor-7034/".
    I changed the Microsoft.ActiveDirectory.WebServices.exe.config file, add two line " <add key=”DebugLevel” value=”Info” />
    <add key=”DebugLogFile” value=”c:windowsdebugadws.log” />", Attach the log
    ADWS Log - AppDomain Microsoft.ActiveDirectory.WebServices.exe with ID 1 - 01/06/2015 17:51:37 ((UTC-04:00) Georgetown, La Paz, Manaus, San Juan)
    OS Version Microsoft Windows NT 6.2.9200.0 - CLR Version 4.0.30319.18449
    ADWS: [1/6/2015 5:51:37 PM] [1] Main: entered
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeBackupPrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeBackupPrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeRestorePrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeRestorePrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeAssignPrimaryTokenPrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeAssignPrimaryTokenPrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeIncreaseQuotaPrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeIncreaseQuotaPrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeDebugPrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeDebugPrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeTcbPrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeTcbPrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: trying to remove priviledge SeShutdownPrivilege
    Utils: [1/6/2015 5:51:37 PM] [1] RemovePriviledgeFromProcess: unable to remove SeShutdownPrivilege priviledge because it was absent
    Utils: [1/6/2015 5:51:37 PM] [1] RemoveUnnecessaryPriviledges: all present unnecessary priviledges removed successfully
    Program: [1/6/2015 5:51:37 PM] [1] Main: Starting Windows service host.
    WindowsHostService: [1/6/2015 5:51:37 PM] [1] WindowsHostService constructed
    WindowsHostService: [1/6/2015 5:51:37 PM] [4] OnStart: entering.
    WindowsHostService: [1/6/2015 5:51:37 PM] [4] OnStart: ServiceStart thread started.
    WindowsHostService: [1/6/2015 5:51:37 PM] [6] StartService: entering.
    PerfCounters: [1/6/2015 5:51:37 PM] [6] InstallCountersIfNeeded: entered
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersInstalled: entered
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersInstalled: System\CurrentControlSet\Services\ADWS key is present
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersInstalled: System\CurrentControlSet\Services\ADWS\Performance key is present
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersInstalled: First Counter value is present
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersInstalled: perf counters are installed
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersCurrent: installed perf counter version: 6
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersCurrent: desired perf counter version: 6
    PerfCounters: [1/6/2015 5:51:37 PM] [6] AreCountersCurrent: perf counter category ADWS is current
    PerfCounters: [1/6/2015 5:51:37 PM] [6] InstallCountersIfNeeded: counters already installed and current, no work needed
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Create Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Delete Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Get Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Put Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Enumerate Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Pull Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Open Enumeration Contexts' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetADGroupMember Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetADPrincipalGroupMembership Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'SetPassword Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'ChangePassword Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetADPrincipalAuthorizationGroup Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'TranslateName Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetADDomainController Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetADDomain Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'MoveADOperationMasterRole Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetADForest Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'ChangeOptionalFeature Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'GetVersion Operations Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Number of Directory Instances' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Possible Connections' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Allocated Connections' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Reserved Connections' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Non-reserved Connections In Use' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Reserved Connections In Use' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Open Web Service Sessions' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Active Web Service Sessions' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Web Service Sessions Created Per Second' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action LDAP Cache Maximum Possible Size' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action LDAP Cache Connection Creation Rate' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action LDAP Cache Connection Reuse Rate' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action DS RPC Cache Maximum Possible Size' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action DS RPC Cache Connection Creation Rate' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action DS RPC Cache Connection Reuse Rate' performance counter
    AdwsPerfCounter: [1/6/2015 5:51:37 PM] [6] AdwsPerfCounter: constructed 'Custom Action Cache Size' performance counter
    PerfCounters: [1/6/2015 5:51:37 PM] [6] Initialize: initializing performance counters
    PerfCounters: [1/6/2015 5:51:37 PM] [6] Initialize: all performance counters initialized
    ADWSHost: [1/6/2015 5:51:37 PM] [6] ADWSHost constructed
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] ProvisionCertificate: using host name for certificate name
    Utils: [1/6/2015 5:51:37 PM] [6] GetComputerDnsName: computer name is xxx.dominio.com
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] ProvisionCertificate: using cert name xxx.dominio.com
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] ProvisionCertificate: loaded certificate
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] AddServiceThrottlingBehavior: MaxConcurrentCalls=32, MaxConcurrentSessions=500
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateServiceHost: including UserName endpoints
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateServiceHost: adding endpoints for Windows/
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateServiceHost: adding endpoints for UserName/
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxReceivedMessageSize=1048576, ReceiveTimeout=00:10:00
    ADWSHostFactory: [1/6/2015 5:51:37 PM] [6] CreateAdwsTransportWithMessageCredentialBinding: MaxDepth=10, MaxArrayLength=16384, MaxStringContentLength=32768
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] StartConfigurationLoading: entered
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] StartConfigurationLoading: establishing watcher on C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe.Config
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: entered
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for InitialPoolConnections, using default value 5
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 10 for MaxPoolConnections
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 50 for MaxPercentageReservedConnections
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for MaxReservedIdleTimeout, using default value 00:02:00
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for MaxReservedTimeout, using default value 00:30:00
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 5 for MaxConnectionsPerUser
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for MaxBindLifetime, using default value 00:15:00
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for MaxServerDownRetry, using default value 10
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for SyntaxCacheEntryLifetime, using default value 01:00:00
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 00:30:00 for MaxEnumContextExpiration
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 00:02:00 for OperationTimeout
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 00:02:00 for MaxPullTimeout
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 5 for MaxEnumCtxsPerSession
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 100 for MaxEnumCtxsTotal
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for CertName, using default value NULL
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for MaxGroupOrMemberEntries, using default value 5000
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for CustomActionConnectionCount, using default value 10
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for CustomActionIdleConnectionTimeout, using default value 00:02:00
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: no value specified for InstanceRediscoveryInterval, using default value 00:01:00
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 32 for MaxConcurrentCalls
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value 500 for MaxConcurrentSessions
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value Info for DebugLevel
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] LoadConfigSettingsFromFile: using loaded value C:\temp\windowsdebugadws.log for DebugLogFile
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] ValidateSettingLimits: entered
    ClassManager: [1/6/2015 5:51:37 PM] [6] Start: starting...
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [3] ScavengerThread: thread starting
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [3] Scavenger: waking up at 00:00:40 interval
    EnumerationContextCache: [1/6/2015 5:51:37 PM] [6] EnumerationContextCache: using timer inverval 00:00:30
    InstanceMap: [1/6/2015 5:51:37 PM] [6] InstanceMap: using timer inverval 00:01:00
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadAll: beginning
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadNTDSInstance: entered
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadNTDSInstance: found NTDS Parameters key
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadNTDSInstance: trying to change state to DC
    InstanceMap: [1/6/2015 5:51:37 PM] [6] AddRemoveSessionPoolAndDictionaryEntry: trying to change state for identifier ldap:389
    InstanceMap: [1/6/2015 5:51:37 PM] [6] AddSessionPool: adding a session pool for NTDS
    DirectoryDataAccessImplementation: [1/6/2015 5:51:37 PM] [6] InitializeInstance: entering, instance=NTDS, init=5, max=10
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] InitializeInstance: entering, instance=NTDS, init=5, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 0
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=NTDS
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=NTDS, new count=1, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 1
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=NTDS
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=NTDS, new count=2, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 2
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=NTDS
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=NTDS, new count=3, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 3
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=NTDS
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=NTDS, new count=4, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 4
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=NTDS
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=NTDS, new count=5, max=10
    InstanceMap: [1/6/2015 5:51:37 PM] [6] AddRemoveSessionPoolAndDictionaryEntry: state change successful (now hosts identifier ldap:389)
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadGCInstance: entered
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckForGlobalCatalog: entered
    DirectoryUtilities: [1/6/2015 5:51:37 PM] [6] GetTimeRemaining: remaining time is 00:02:00
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckForGlobalCatalog: isGlobalCatalogReady: TRUE
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckForGlobalCatalog: NTDS Settings DN: CN=NTDS Settings,CN=XXX,CN=Servers,CN=Alpacoma,CN=Sites,CN=Configuration,DC=dominio,DC=com
    DirectoryUtilities: [1/6/2015 5:51:37 PM] [6] GetTimeRemaining: remaining time is 00:02:00
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckForGlobalCatalog: options: 1
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadGCInstance: CheckForGlobalCatalog=True
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadGCInstance: trying to change state to Global Catalog
    InstanceMap: [1/6/2015 5:51:37 PM] [6] AddRemoveSessionPoolAndDictionaryEntry: trying to change state for identifier ldap:3268
    InstanceMap: [1/6/2015 5:51:37 PM] [6] AddSessionPool: adding a session pool for GC
    DirectoryDataAccessImplementation: [1/6/2015 5:51:37 PM] [6] InitializeInstance: entering, instance=GC, init=5, max=10
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] InitializeInstance: entering, instance=GC, init=5, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 0
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=GC
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=GC, new count=1, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 1
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=GC
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=GC, new count=2, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 2
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=GC
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=GC, new count=3, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 3
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=GC
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=GC, new count=4, max=10
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ConnectionPool: trying to add connection 4
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: entering, instance=GC
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] ConnectionPoolEntry: connection created
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] AddConnectionIfPossible: grew pool, instance=GC, new count=5, max=10
    InstanceMap: [1/6/2015 5:51:37 PM] [6] AddRemoveSessionPoolAndDictionaryEntry: state change successful (now hosts identifier ldap:3268)
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadADAMInstances: entered
    InstanceMap: [1/6/2015 5:51:37 PM] [6] CheckAndLoadAll: caught unexpected exception System.IO.IOException: No more data is available.
    at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
    at Microsoft.Win32.RegistryKey.InternalGetSubKeyNames()
    at Microsoft.ActiveDirectory.WebServices.InstanceMap.DiscoverInstancesFromRegistry(String regRootKey, String regKeyInstancePrefix, Boolean& instanceEncounteredErrorsOnThisRun, List`1 discoveredInstances, DirectoryType directoryType)
    at Microsoft.ActiveDirectory.WebServices.InstanceMap.CheckAndLoadADAMInstances()
    at Microsoft.ActiveDirectory.WebServices.InstanceMap.CheckAndLoadAll()
    ADWSHost: [1/6/2015 5:51:37 PM] [6] OnClosed: entered
    CustomActionCaches: [1/6/2015 5:51:37 PM] [6] StopCaches: disposing Custom Action connection caches
    ClassManager: [1/6/2015 5:51:37 PM] [6] Stop: closing down...
    EnumerationContextCache: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    QuotaTracker: [1/6/2015 5:51:37 PM] [6] Clear: clearing all usage
    DirectoryActionImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    DirectoryDataAccessImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [3] ScavengerThread: woke up
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [3] ScavengerThread: received termination signal, exiting
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing pool
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing (instance=NTDS)...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ProhibitConnectionAcquisition: entering, instance=NTDS
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing pool
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing (instance=GC)...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] ProhibitConnectionAcquisition: entering, instance=GC
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    ConnectionPool: [1/6/2015 5:51:37 PM] [6] Dispose: disposing a ConnectionPoolEntry
    ConnectionPoolEntry: [1/6/2015 5:51:37 PM] [6] Dispose: disposing...
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing utility connection NTDS
    LdapSessionPoolImplementation: [1/6/2015 5:51:37 PM] [6] Dispose: disposing utility connection GC
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] StopConfigurationLoading: entered
    ConfigurationSettings: [1/6/2015 5:51:37 PM] [6] Dispose: disposing
    Some Idea, Tks for your help.
    migrations

    Here a dump file when I try to start the service, I hope can you help me.
    Version=1
    EventType=CLR20r3
    EventTime=130652059133527283
    ReportType=2
    Consent=1
    ReportIdentifier=4368792e-974e-11e4-93f7-3440b59e2092
    IntegratorReportIdentifier=4368792d-974e-11e4-93f7-3440b59e2092
    NsAppName=Microsoft.ActiveDirectory.WebServices.exe
    Response.type=4
    Sig[0].Name=Problem Signature 01
    Sig[0].Value=V0KXCIQIJBOA2NW5DIQBFTEBV5SCPPFH
    Sig[1].Name=Problem Signature 02
    Sig[1].Value=6.2.9200.16579
    Sig[2].Name=Problem Signature 03
    Sig[2].Value=516356a2
    Sig[3].Name=Problem Signature 04
    Sig[3].Value=System.ServiceModel
    Sig[4].Name=Problem Signature 05
    Sig[4].Value=4.0.30319.34230
    Sig[5].Name=Problem Signature 06
    Sig[5].Value=53be5c02
    Sig[6].Name=Problem Signature 07
    Sig[6].Value=ca
    Sig[7].Name=Problem Signature 08
    Sig[7].Value=c4
    Sig[8].Name=Problem Signature 09
    Sig[8].Value=I0SHPZEWVQV4P1UJY40X15MQTHF34RR5
    DynamicSig[1].Name=OS Version
    DynamicSig[1].Value=6.2.9200.2.0.0.272.7
    DynamicSig[2].Name=Locale ID
    DynamicSig[2].Value=1033
    DynamicSig[22].Name=Additional Information 1
    DynamicSig[22].Value=5220
    DynamicSig[23].Name=Additional Information 2
    DynamicSig[23].Value=52200675db6baa97bf416b02ff886e01
    DynamicSig[24].Name=Additional Information 3
    DynamicSig[24].Value=0b14
    DynamicSig[25].Name=Additional Information 4
    DynamicSig[25].Value=0b146b7eb5ed6bd9871c898c60ee5051
    UI[2]=C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe
    UI[5]=Check online for a solution (recommended)
    UI[6]=Check for a solution later (recommended)
    UI[7]=Close
    UI[8]=Microsoft.ActiveDirectory.WebServices stopped working and was closed
    UI[9]=A problem caused the application to stop working correctly. Windows will notify you if a solution is available.
    UI[10]=&Close
    LoadedModule[0]=C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe
    LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll
    LoadedModule[2]=C:\Windows\SYSTEM32\MSCOREE.DLL
    LoadedModule[3]=C:\Windows\system32\KERNEL32.dll
    LoadedModule[4]=C:\Windows\system32\KERNELBASE.dll
    LoadedModule[5]=C:\Windows\SYSTEM32\dlphook.x64.dll
    LoadedModule[6]=C:\Windows\SYSTEM32\VERSION.dll
    LoadedModule[7]=C:\Windows\system32\PSAPI.DLL
    LoadedModule[8]=C:\Windows\system32\ADVAPI32.dll
    LoadedModule[9]=C:\Windows\system32\WS2_32.dll
    LoadedModule[10]=C:\Windows\system32\msvcrt.dll
    LoadedModule[11]=C:\Windows\SYSTEM32\sechost.dll
    LoadedModule[12]=C:\Windows\system32\RPCRT4.dll
    LoadedModule[13]=C:\Windows\system32\NSI.dll
    LoadedModule[14]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
    LoadedModule[15]=C:\Windows\system32\SHLWAPI.dll
    LoadedModule[16]=C:\Windows\system32\USER32.dll
    LoadedModule[17]=C:\Windows\system32\GDI32.dll
    LoadedModule[18]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    LoadedModule[19]=C:\Windows\SYSTEM32\MSVCR110_CLR0400.dll
    LoadedModule[20]=C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\51fbf5aac9c6f1aef14557276f98ad28\mscorlib.ni.dll
    LoadedModule[21]=C:\Windows\system32\ole32.dll
    LoadedModule[22]=C:\Windows\SYSTEM32\combase.dll
    LoadedModule[23]=C:\Windows\SYSTEM32\CRYPTBASE.dll
    LoadedModule[24]=C:\Windows\SYSTEM32\bcryptPrimitives.dll
    LoadedModule[25]=C:\Windows\SYSTEM32\CRYPTSP.dll
    LoadedModule[26]=C:\Windows\system32\rsaenh.dll
    LoadedModule[27]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll
    LoadedModule[28]=C:\Windows\system32\OLEAUT32.dll
    LoadedModule[29]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System\803e478b5cb2fe994c4f977853849956\System.ni.dll
    LoadedModule[30]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Serv759bfb78#\060758702287150a3b9ca51bfbd135e4\System.ServiceProcess.ni.dll
    LoadedModule[31]=C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.Shared.dll
    LoadedModule[32]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Configuration\af08c33d3e853168e58f0bb32118170b\System.Configuration.ni.dll
    LoadedModule[33]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Core\5641065f716dfd6c76dd7bc6ab18c47a\System.Core.ni.dll
    LoadedModule[34]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Xml\b3344890d2d919e93f506faabd08186a\System.Xml.ni.dll
    LoadedModule[35]=C:\Windows\system32\urlmon.dll
    LoadedModule[36]=C:\Windows\system32\iertutil.dll
    LoadedModule[37]=C:\Windows\system32\WININET.dll
    LoadedModule[38]=C:\Windows\system32\USERENV.dll
    LoadedModule[39]=C:\Windows\system32\profapi.dll
    LoadedModule[40]=C:\Windows\SYSTEM32\Secur32.dll
    LoadedModule[41]=C:\Windows\SYSTEM32\SSPICLI.DLL
    LoadedModule[42]=C:\Windows\system32\SHELL32.dll
    LoadedModule[43]=C:\Windows\SYSTEM32\SHCORE.dll
    LoadedModule[44]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Dire5d62f0a2#\7ab37f1ca732666c1ab41d8e500942e0\System.DirectoryServices.Protocols.ni.dll
    LoadedModule[45]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.ServiceModel\4e643cb8b12402db89eb2d5839872b78\System.ServiceModel.ni.dll
    LoadedModule[46]=C:\Windows\assembly\NativeImages_v4.0.30319_64\SMDiagnostics\02b9ba874b1c07b6016aa9406745e96b\SMDiagnostics.ni.dll
    LoadedModule[47]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Web.Services\f936aad8a951da6674d460db1855a3db\System.Web.Services.ni.dll
    LoadedModule[48]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Servd1dec626#\8944debbd3293f930c7e37b64aed0d77\System.ServiceModel.Internals.ni.dll
    LoadedModule[49]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.IdentityModel\5844c97798b9e56b45cb0e5d3505ffd2\System.IdentityModel.ni.dll
    LoadedModule[50]=C:\Windows\system32\crypt32.dll
    LoadedModule[51]=C:\Windows\system32\MSASN1.dll
    LoadedModule[52]=C:\Windows\SYSTEM32\DPAPI.dll
    LoadedModule[53]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Runteb92aa12#\3838e7c87e962eaec01572bff0396922\System.Runtime.Serialization.ni.dll
    LoadedModule[54]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Servf73e6522#\38df17ed0feec9b27d7d33272eecc176\System.ServiceModel.Web.ni.dll
    LoadedModule[55]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Dired13b18a9#\4ecba93b4eae5bb0c97205c4e4196702\System.DirectoryServices.ni.dll
    LoadedModule[56]=C:\Windows\system32\wldap32.dll
    LoadedModule[57]=C:\Windows\system32\mswsock.dll
    LoadedModule[58]=C:\Windows\SYSTEM32\DNSAPI.dll
    LoadedModule[59]=C:\Windows\System32\rasadhlp.dll
    LoadedModule[60]=C:\Windows\System32\fwpuclnt.dll
    LoadedModule[61]=C:\Windows\SYSTEM32\IPHLPAPI.DLL
    LoadedModule[62]=C:\Windows\SYSTEM32\WINNSI.DLL
    LoadedModule[63]=C:\Windows\SYSTEM32\DSPARSE.dll
    LoadedModule[64]=C:\Windows\system32\kerberos.DLL
    LoadedModule[65]=C:\Windows\SYSTEM32\cryptdll.dll
    LoadedModule[66]=C:\Windows\SYSTEM32\bcrypt.dll
    LoadedModule[67]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll
    FriendlyEventName=Stopped working
    ConsentKey=CLR20r3
    AppName=Microsoft.ActiveDirectory.WebServices
    AppPath=C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe
    NsPartner=windows
    NsGroup=windows8
    Tks for your help.
    migrations

  • Need Help creating new user in Active Directory

    I am trying to create a new user in active directory via a java application. I have included the code that I am using. I am able to successfully bind to Active Directory. I have been able to change passwords, and delete users, but I have not been able to create a user.
    ldapHost : "mta101.DOM101.CEL.ACC.AF.MIL"
    domainName: "dc=dom101,dc=cel,dc=acc,dc=af,dc=mil"
    existing account: CN=Brett K. Humpherys,OU=Users,OU=CEL
    I get the following error on the createSubcontext statement:
    javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C09098B, comment: Error in attribute conversion operation, data 0, v893 ; remaining name 'CN=test1,OU=Users,OU=CEL'
    I have commented out the password portion and change the ObjectCategory to a 32 and get the same error.
        public GblStatus createAccount7(DbaDb dbConn,
                                        String jsrcName,
                                        String personName,
                                        String username,
                                        String password)
          Hashtable ldapEnv = new Hashtable(11);
          ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
          ldapEnv.put(Context.PROVIDER_URL, "ldap://" + this.ldapHost + ":636");
          ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
          ldapEnv.put(Context.SECURITY_PROTOCOL, "ssl");
          ldapEnv.put(Context.REFERRAL, "ignore");
          ldapEnv.put(Context.SECURITY_PRINCIPAL,"cn=" + this.adminAcct + ",cn=users," + this.domainName);
          ldapEnv.put(Context.SECURITY_CREDENTIALS, this.adminPwd);
           try
            // Create the initial context
            DirContext ctx = new InitialDirContext(ldapEnv);
            BasicAttributes attrs = new BasicAttributes();
            BasicAttribute ocs = new BasicAttribute("objectclass");
            ocs.add("top");
            ocs.add("person");
            ocs.add("organizationalPerson");
            ocs.add("user");
            attrs.put(ocs);
            BasicAttribute gn = new BasicAttribute("givenName", "test1");
            attrs.put(gn);
            BasicAttribute sn = new BasicAttribute("sn", "");
            attrs.put(sn);
            BasicAttribute cn = new BasicAttribute("cn", "test1");
            attrs.put(cn);
            BasicAttribute uac = new BasicAttribute("userAccountControl", "66048");
            attrs.put(uac);
            BasicAttribute sam = new BasicAttribute("sAMAccountName", "test1");
            attrs.put(sam);
            BasicAttribute disName = new BasicAttribute("displayName", "test1");
            attrs.put(disName);
            BasicAttribute userPrincipalName = new BasicAttribute
                                          ("userPrincipalName", "[email protected]");
            attrs.put(userPrincipalName);
            BasicAttribute instanceType = new BasicAttribute("instanceType", "4");
            attrs.put(instanceType);
            BasicAttribute objectCategory = new BasicAttribute
                      ("objectCategory","CN=User,CN=Schema,CN=Configuration," + domainName);
            attrs.put(objectCategory);
            String newVal = new String("\"password\"");
            byte _bytes[] = newVal.getBytes("Unicode");
    byte bytes[] = new byte[_bytes.length - 2];
    System.arraycopy(_bytes, 2, bytes, 0, _bytes.length - 2);
    BasicAttribute attribute = new BasicAttribute("unicodePwd");
    attribute.add((byte[]) bytes);
    attrs.put(attribute);
    ctx.createSubcontext("CN=test1,OU=Users,OU=CEL", attrs);
    ctx.close();
    catch (NameAlreadyBoundException nex)
    System.out.println("User ID is already in use, please select a different user ID ...");
    catch (Exception ex)
    System.out.println("Failed to create user account... Please verify the user information...");
    ex.printStackTrace();
    return new GblStatus();
    Any help would be much appreciated.

    Hi .,
    me too got up with same problem., can anyone help me.??
    Someone help me to create attributes in AD using LDAP
    package LDAPpack;
    import javax.naming.*;
    import javax.naming.directory.*;
    import javax.naming.ldap.InitialLdapContext;
    import javax.naming.ldap.LdapContext;
    import java.util.Hashtable;
    class CreateAttrs {
    public static void main(String[] args) {
         Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              env.put(Context.PROVIDER_URL, "ldap://10.242.6.166:389/");
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL, "CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org");
                        env.put(Context.SECURITY_CREDENTIALS, "password-1");
              LdapContext ctx =null;
              try {
                   //ctx = new InitialLdapContext(env,null);
                   try {
    ctx = new InitialLdapContext(env,null);
                   catch(NamingException e) {
    System.out.println("Login failed");
    System.exit(0);
    if(ctx!=null){              
    System.out.println("Login Successful");
    byte[] buf = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; // same data
         // Create a multivalued attribute with 4 String values
         BasicAttribute oc = new BasicAttribute("objectClassNew", "topNew");
         oc.add("personNew");
         oc.add("organizationalPersonNew");
         // Create an attribute with a byte array
         BasicAttribute photo = new BasicAttribute("jpegPhotoNew", buf);
         // Create attribute set
         BasicAttributes attrs = new BasicAttributes(true);
         attrs.put(oc);
         attrs.put(photo);
         Attributes attrs1 = ctx.getAttributes("CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org");
    System.out.println(attrs1);
    Context result = ctx.createSubcontext("CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org", attrs);
    //i got error here; i attach the error below.
         ctx.close();
    System.out.println("close");
         catch(NamingException e){
              e.printStackTrace();
    ERROR:
    Login Successful
    javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B38, comment: Error in attribute conversion operation, data 0, vece
    ANYONE HELP ME PLS.
    Edited by: vencer on Jun 19, 2008 12:38 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Active Directory schema extensions

    Hi
    We are in a process of implementing SAP LDAP sync to manage users from MS Active Directory. SAP requires schema extension generated by RSLDAPSCHEMAEXT program to be applied to Active Directory so that report RSLDAPSYNC_USER can be identify SAP users in MS AD.
    The MS AD team says that any non miscrosoft schema extensions are not supported as OIDs of the schema might conflict with other applications / patches.
    Are the MS AD schema extensions generated by SAP program RSLDAPSCHEMAEXT supported / certified by Microsoft.
    Harsh

    Hi Harsh,
    I would like to point you also to SAP Note 888848 - Notes on schema enhancement with RSLDAPSCHEMAEXT.
    It especially states that:
    ..."The text document generated by RSLDAPSCHEMAEXT was supplied and validate as part of a certification process by the directory vendor."...
    that means in this case by Microsoft.
    If you decide not to use the schema extension that has been supplied by Microsoft you can use attributes that are already existing in your Active Directory as Juergen already pointed out.
    As an example Microsoft Exchange Server creates several additional attributes such as extensionattribute1, ... , extensionattribute15 as part of the installation process. These attributes might be an option for you if you do not want to use the schema extension suggested by RSLDAPSCHEMAEXT.
    Please have in mind that the filter attribute that you will use to determine the SAP username should be indexed since this will reduce the synchronization time.
    Best Regards,
    André

  • Filtering Groups on Windows Active Directory using LDAP Authentication

    Hi All,
    I have small module that filters the groups from the Windows AD using LDAP attributes and flushes the data into the DB[code below].
    This module was developed and tested on weblogic 8.1[on windows]and works fine.
    Now the same is moved to another environment- Websphere on Linux Suse. The code fails to retreieve any value from the Windows AD.
    Please note no exception is aslo thrown.
    env.put(Context.INITIAL_CONTEXT_FACTORY,ldapCtxFactory);
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,authentication);
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL, domainController);
              // Create the initial directory context
              try {
                                  dirCtx = new InitialDirContext(env);
                   // Create the search controls           
                   SearchControls searchCtls = new SearchControls();
                   //Specify the attributes to return
                   String returnedAtts[]={"member"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   int totalResults = 0;
                   int iteration=0;
                   // Search for objects using the filter
                   NamingEnumeration results = ctx.search(searchBase, searchFilter, searchCtls);
    In the above code the method exits even before the try block[i could detect this using Sysout's]
    Below is the property file from which the values are read.
    admin=username
    password=password
    #AD search attributes
    searchBase=DC=domainname,DC=domainname
    searchFilter=(&(objectClass=group) (CN=value*))
    #JNDI context attributes
    ldapCtxFactory=com.sun.jndi.ldap.LdapCtxFactory
    authentication=simple
    domainController=ldap://address
    groupPattern=pattern
    Please Assit,
    Thanks in Advance
    Message was edited by:
    radiant
    Message was edited by:
    radiant

    Assuming it is the same Active Directory environment and only your Java platform has changed, the I can only assume that if no exception is thrown, and no data is returned, then the credentials you are using on the new Java platform are being mapped to an anonymous user (perhaps a blank password ?). By default, Windows Server 2003 domains, do not return any results to anonymous users.

  • Powershell Active Directory Account Expiration Script

    I am putting together a script that creates a user account in AD, sets the password, adds groups, etc.  The part I am having problems with is when the user selects the Contractor employee option and is prompted for the expiration date of the AD account. 
    The script will create the account, but the expiration date is not set in AD.  Any suggestions?
    Here's the code:
    #Script to create Active Directory account
    #Add the Active Directory Module if not already present
    if (-not (Get-Module ActiveDirectory))
    Import-Module ActiveDirectory -Force
    Write-Host ""
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host ""
    Write-Host "Computer Access"      
    Write-Host "Create Active Directory User Script"
    Write-Host "PowerShell 3.0"
    Write-Host "Version: 1.2"                   
    Write-Host "Date: 4/14/2014"                       
    Write-Host "Author: "
    Write-Host ""
    Write-Host "Please review the created Active Directory Account" -ForegroundColor Red -BackgroundColor Yellow
    Write-Host ""
    Write-Host "Base Business Unit Group Memberships are added only" -ForegroundColor Red -BackgroundColor Yellow
    Write-Host ""
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host ""
    Write-Host ""
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host "Creating Active Directory Account" -ForegroundColor Yellow
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host ""
    #Specify the target OU for new users
    $targetOU = "OU=Personnel,OU=ETA,DC=eta,DC=state,DC=tx"
    #Find the current domain info
    $domdns = (Get-ADDomain).dnsroot # for UPN generation
    #Set Account Variables
    #Set Username with Dialogue Box
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Username"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setusername=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setusername=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the username for the account:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $samname = ($setusername | Out-String)
    $samname = ($setusername) + ("")
    function validateUser
        param(
        [string]$username
        #if the username is passed without domain\
        if(($username.StartsWith("domain\")) -eq $false)
            $user = Get-ADUser -Filter { SamAccountName -eq $username }
            if (!$user)
                return $false
            else
                return $true
        elseif(($username.StartsWith("domain\")) -eq $true)
            $username = ($username.Split("\")[1])
            $user = Get-ADUser -Filter { SamAccountName -eq $username }
            if (!$user)
                return $false
            else
                return $true
    $usercheck = validateUser -username $samname
    if($userCheck -eq $true) {
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    [Windows.Forms.MessageBox]::Show("Username already exists in AD please check and retry",`
     "Username Check", [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Stop)
    [environment]::Exit(0)
    else {} #Continue
    Write-Host ""
    Write-Host "USERNAME has been set to" $samname -ForegroundColor Yellow
    #Set User Accounts First Name
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "First Name"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setfirstname=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setfirstname=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the users first name:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $givname = ($setfirstname | Out-String)
    $givname = ("$setfirstname") + ("")
    Write-Host ""
    Write-Host "FIRST NAME has been set to" $givname -ForegroundColor Yellow
    #Set User Accounts Last Name
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Last Name"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setlastname=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setlastname=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the users last name:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $surname = ($setlastname | Out-String)
    $surname = ("$setlastname") + ("")
    Write-Host ""
    Write-Host "LAST NAME has been set to" $surname -ForegroundColor Yellow
    #Set the Department Number for the Active Directory Account
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Cost Center"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setcostcode=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setcostcode=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the cost center for the account:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $costcode = ($setcostcode | Out-String)
    $costcode = ("$setcostcode") + ("")
    Write-Host ""
    Write-Host "COSTCODE has been set to" $costcode -ForegroundColor Yellow
    #This creates a checkbox called Employee
    $objTypeCheckbox = New-Object System.Windows.Forms.Checkbox
    $objTypeCheckbox.Location = New-Object System.Drawing.Size(10,220)
    $objTypeCheckbox.Size = New-Object System.Drawing.Size(500,20)
    $objTypeCheckbox.Text = "Employee"
    $objTypeCheckbox.TabIndex = 4
    $objForm.Controls.Add($objTypeCheckbox)
    #This creates a checkbox called Citrix User
    $objCitrixUserCheckbox = New-Object System.Windows.Forms.Checkbox
    $objCitrixUserCheckbox.Location = New-Object System.Drawing.Size(10,240)
    $objCitrixUserCheckbox.Size = New-Object System.Drawing.Size(500,20)
    $objCitrixUserCheckbox.Text = "Citrix User"
    $objCitrixUserCheckbox.TabIndex = 5
    $objForm.Controls.Add($objCitrixUserCheckbox)
    #Set Permanent or Contractor (Expiration Date)
    [void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
    [void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
    [System.Windows.Forms.Application]::EnableVisualStyles()
    $form1 = New-Object 'System.Windows.Forms.Form'
    $datetimepicker1 = New-Object 'System.Windows.Forms.DateTimePicker'
    $radiobuttonPermanent = New-Object 'System.Windows.Forms.RadioButton'
    $radiobuttonContractor = New-Object 'System.Windows.Forms.RadioButton'
    $buttonOK = New-Object 'System.Windows.Forms.Button'
    $InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
    $radiobuttonContractor_CheckedChanged={
        if($radiobuttonContractor.Checked){
            $datetimepicker1.Visible=$true
        }else{
            $datetimepicker1.Visible=$false
    $Form_StateCorrection_Load=
        #Correct the initial state of the form to prevent the .Net maximized form issue
        $form1.WindowState = $InitialFormWindowState
    $Form_Cleanup_FormClosed=
        #Remove all event handlers from the controls
        try
            $radiobuttonContractor.remove_CheckedChanged($radiobuttonContractor_CheckedChanged)
            $form1.remove_Load($FormEvent_Load)
            $form1.remove_Load($Form_StateCorrection_Load)
            $form1.remove_FormClosed($Form_Cleanup_FormClosed)
        catch [Exception]
    $form1.Controls.Add($datetimepicker1)
    $form1.Controls.Add($radiobuttonPermanent)
    $form1.Controls.Add($radiobuttonContractor)
    $form1.Controls.Add($buttonOK)
    $form1.AcceptButton = $buttonOK
    $form1.ClientSize = '508, 262'
    $form1.FormBorderStyle = 'FixedDialog'
    $form1.MaximizeBox = $False
    $form1.MinimizeBox = $False
    $form1.Name = "form1"
    $form1.StartPosition = 'CenterScreen'
    $form1.Text = "Form"
    $form1.add_Load($FormEvent_Load)
    # datetimepicker1
    $datetimepicker1.Location = '160, 91'
    $datetimepicker1.Name = "datetimepicker1"
    $datetimepicker1.Size = '200, 20'
    $datetimepicker1.TabIndex = 3
    $datetimepicker1.Visible = $False
    # radiobuttonPermanent
    $radiobuttonPermanent.Location = '33, 57'
    $radiobuttonPermanent.Name = "radiobuttonPermanent"
    $radiobuttonPermanent.Size = '104, 24'
    $radiobuttonPermanent.TabIndex = 2
    $radiobuttonPermanent.TabStop = $True
    $radiobuttonPermanent.Text = "Permanent"
    $radiobuttonPermanent.UseVisualStyleBackColor = $True
    # radiobuttonContractor
    $radiobuttonContractor.Location = '33, 87'
    $radiobuttonContractor.Name = "radiobuttonContractor"
    $radiobuttonContractor.Size = '104, 24'
    $radiobuttonContractor.TabIndex = 1
    $radiobuttonContractor.TabStop = $True
    $radiobuttonContractor.Text = "Contractor"
    $radiobuttonContractor.UseVisualStyleBackColor = $True
    $radiobuttonContractor.add_CheckedChanged($radiobuttonContractor_CheckedChanged)
    # buttonOK
    $buttonOK.Anchor = 'Bottom, Right'
    $buttonOK.DialogResult = 'OK'
    $buttonOK.Location = '421, 227'
    $buttonOK.Name = "buttonOK"
    $buttonOK.Size = '75, 23'
    $buttonOK.TabIndex = 0
    $buttonOK.Text = "OK"
    $buttonOK.UseVisualStyleBackColor = $True
    #endregion Generated Form Code
    #Save the initial state of the form
    $InitialFormWindowState = $form1.WindowState
    #Init the OnLoad event to correct the initial state of the form
    $form1.add_Load($Form_StateCorrection_Load)
    #Clean up the control events
    $form1.add_FormClosed($Form_Cleanup_FormClosed)
    #Show the Form
    $form1.ShowDialog()
    #Set the password for the new user account
    #Change P@$$w0rd to whatever you want the account password to be
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Password"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setpassword=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setpassword=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,40)
    $objLabel.Text = "Please enter the password you wish to set. Press Enter for P@SSw0rd:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,60)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set password and continue
    $userpassword = ($setpassword | Out-String)
    $userpassword = ("$setpassword") + ("")
    if ($userpassword -eq "") {$userpassword = 'P@SSw0rd'}
    $password = (ConvertTo-SecureString $userpassword -AsPlainText -Force)
    #Set Variables for New-ADUser cmdlet
    $dplname = "$surname, $givname"
    $upname = "$givname.$surname" + "@" + "$domdns"
    $email = "$givname" + "." + "$surname" + "@eta.state.tx.us"
    $office = "WBT"
    $description = "$costcode"
    $description2 = "611IS - Permanent"
    $description3 = "611PM - Permanent"
    $description4 = "501 - Permanent"
    ##$loginscript = "yourloginscriptname"
    $servername = "teafs2"
    $homedir = "\\$($servername)\User\$($samname)"
    $homedirpath = "\\$($servername)\User\$($samname)"
    $Company= "ETA"
    $department = "yourdepartment"
    $department4 = "School Finance"
    $departmentnumber = "" + "-" + "$costcode"
    Write-Host ""
    Write-Host "HOME SERVER is" $servername -ForegroundColor Yellow
    Write-Host ""
    Write-Host "HOME DIRECTORY has been set to" $homedir -ForegroundColor Yellow
    Write-Host ""
    Write-Host "DEPARTMENT has been set to" $department -ForegroundColor Yellow
    Write-Host ""
    Write-Host "DESCRIPTION has been set to" $departmentnumber -ForegroundColor Yellow
    Write-Host ""
    #Create Active Directory Account
    New-ADUser -Name $dplname -SamAccountName $samname -DisplayName $dplname `
    -givenname $givname -surname $surname -userprincipalname $upname -emailaddress $email `
    -Path $targetou -Enabled $true -ChangePasswordAtLogon $true -Department $department `
    -OtherAttributes @{'departmentNumber'="$departmentnumber"} -Company $Company -HomeDrive "H" -HomeDirectory $homedir `
    -Description $description -Office $office -ScriptPath $loginscript -AccountPassword $password `
    #Add User to Active Directory Groups Based on Description Field
    If ((Get-ADUser $samname -Properties description).description -eq $description2) {
      Add-ADGroupMember -Identity "CN=InformationSystemsPrintGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=InformationSystemsOUDataGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=InformationSystemsNetworkAccess,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Mail users,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
    If ((Get-ADUser $samname -Properties description).description -eq $description3) {
      Add-ADGroupMember -Identity "CN=ProjectMgmtNetworkAccess,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=ProjectMgmtOUDataGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=ProjectMgmtPrintGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Cognos ETASE Dev-Test-Prod,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=PMO ALL,OU=Distribution Groups,OU=Mailbox accounts,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=PMO Permanent,OU=Distribution Groups,OU=Mailbox accounts,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Mail users,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
    If ((Get-ADUser $samname -Properties description).description -eq $description4) {
      Add-ADGroupMember -Identity "CN=SchoolFinancePrintGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=SchoolFinanceOUDataGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=SchoolFinanceNetworkAccess,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Mail users,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
    #Does the user require a mailbox?
    $mailbox = New-Object -ComObject wscript.shell
    $intAnswer = $mailbox.popup("Does this user require a mailbox?", `
    0,"Create Mailbox",32+4)
    If ($intAnswer -eq 6) {
        Add-ADGroupMember -Identity "YourADGroupName5" -Member $samname
        $mailbox.popup("User added to EMail Provisioning Group", `
        0,"Created",64+0)
    } else {
        $mailbox.popup("User has not been added to the EMail Provisioning Group", `
        0,"Not Created",64+0)
    #Does the user require a LYNC Account?
    $lyncaccount = New-Object -ComObject wscript.shell
    $intAnswer = $lyncaccount.popup("Does this user require a LYNC Account?", `
    0,"Create LYNC Account",32+4)
    If ($intAnswer -eq 6) {
        Add-ADGroupMember -Identity "YourADGroupName6" -Member $samname
        $lyncaccount.popup("User added to LYNC Provisioning Group", `
        0,"Created",64+0)
    } else {
        $lyncaccount.popup("User has not been added to the LYNC Provisioning Group", `
        0,"Not Created",64+0)
    #Create Home Directory and Set Permissions on Home Directory
    New-Item -path $homedirpath -type directory
    $acl = Get-ACL -path $homedirpath
    $permission = "yourdomainname\$($samname)","Modify","ContainerInherit,ObjectInherit","None","Allow"
    $accessrule = new-object System.Security.AccessControl.FileSystemAccessRule $permission
    $acl.SetAccessRule($accessrule)
    $acl | Set-ACL -path $homedirpath
    ##Set Share Permissions on Home Directory
    $Computer = $servername
    $Class = "Win32_Share"
    $Method = "Create"
    $name = $sharename
    $path = $sharedirpath
    $description = ""
    $sd = ([WMIClass] "\\$Computer\root\cimv2:Win32_SecurityDescriptor").CreateInstance()
    $ACE = ([WMIClass] "\\$Computer\root\cimv2:Win32_ACE").CreateInstance()
    $Trustee = ([WMIClass] "\\$Computer\root\cimv2:Win32_Trustee").CreateInstance()
    $Trustee.Name = "EVERYONE"
    $Trustee.Domain = $Null
    $Trustee.SID = @(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)
    $ace.AccessMask = 2032127
    $ace.AceFlags = 3
    $ace.AceType = 0
    $ACE.Trustee = $Trustee
    $sd.DACL += $ACE.psObject.baseobject
    $mc = [WmiClass]"\\$Computer\ROOT\CIMV2:$Class"
    $InParams = $mc.psbase.GetMethodParameters($Method)
    $InParams.Access = $sd
    $InParams.Description = $description
    $InParams.MaximumAllowed = $Null
    $InParams.Name = $name
    $InParams.Password = $Null
    $InParams.Path = $path
    $InParams.Type = [uint32]0
    $R = $mc.PSBase.InvokeMethod($Method, $InParams, $Null)
    switch ($($R.ReturnValue))
      0 {Write-Host "Share:$name Path:$path Result:Success"; break}
      2 {Write-Host "Share:$name Path:$path Result:Access Denied" -foregroundcolor red -backgroundcolor yellow;break}
      8 {Write-Host "Share:$name Path:$path Result:Unknown Failure" -foregroundcolor red -backgroundcolor yellow;break}
      9 {Write-Host "Share:$name Path:$path Result:Invalid Name" -foregroundcolor red -backgroundcolor yellow;break}
      10 {Write-Host "Share:$name Path:$path Result:Invalid Level" -foregroundcolor red -backgroundcolor yellow;break}
      21 {Write-Host "Share:$name Path:$path Result:Invalid Parameter" -foregroundcolor red -backgroundcolor yellow;break}
      22 {Write-Host "Share:$name Path:$path Result:Duplicate Share" -foregroundcolor red -backgroundcolor yellow;break}
      23 {Write-Host "Share:$name Path:$path Result:Reedirected Path" -foregroundcolor red -backgroundcolor yellow;break}
      24 {Write-Host "Share:$name Path:$path Result:Unknown Device or Directory" -foregroundcolor red -backgroundcolor yellow;break}
      25 {Write-Host "Share:$name Path:$path Result:Network Name Not Found" -foregroundcolor red -backgroundcolor yellow;break}
      default {Write-Host "Share:$name Path:$path Result:*** Unknown Error ***" -foregroundcolor red -backgroundcolor yellow;break}

    Would you be able to show me how it's done?
    Here's an example:
    $date = Read-Host 'Enter a date (e.g. 4/23/14)'
    Write-Host "Original string: $date"
    $dateTime = [datetime]$date
    Write-Host "DateTime object: $dateTime"
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Crystal Reports 2008 - Report off of Active Directory

    Hello,
    I have found a few articles on how to do this, but they don't seem to follow my wizard.
    Can someone provide a tutorial on how to create a Crystal Reports 2008 report against active directory?
    I have been able to do the following so far:
    1) Create new OLE DB (ADO) connection
    2) From Provider, choose OLE DB Provider for Microsoft Directory Services.
    3) The fields I have are Data Source, User ID, and Password.
       - I do not have a field for "LOCATION" that is referenced in documentation I have found on here.
    4) I enter my server.domain.com:389 for active directory, a valid username and password.
    5) It seems to create the connection, and wants me to ADD COMMAND. I haven't been able to find a command that actually works online. Does anyone have one? I.e.: Employee and Supervisor names.
    Thank you,
    Lin

    backing up a step or two, make sure that the username you are using has a domain alias infront of it, something like "mydomain\myusername" should be the correct format. even if you don't get an error when you create the connection it may be incorrect. when entering in a command is the only time it actually tries to authenticate against the AD server. If you make a mistake when entering in the original connection (anytime before the add command part) remember that you will need to exit out of Crystal Reports and come back in. the connection can not be remade or edited once entered.
    Now, as for what to put into the query, you will probably need to talk with your windows AD administrators. the one I used for my organization was something like this (replace the stuff between the <> marks with your data):
    SELECT samaccountname, sn, givenname, mail FROM 'LDAP://OU=<yourOU>,DC=<yourdomain1>,DC=<yourdomain2>'
    remember you can not use * to get data, it seems to take what ever properties you directly name. if you need names of properties or items to call, I'd recommend a quick google search on LDAP SQL queries.
    I hope this helps

Maybe you are looking for

  • Need help with the following kernel panic message

    Interval Since Last Panic Report:  343442 sec Panics Since Last Report:          1 Anonymous UUID:                    20AE5901-94AA-497D-A08A-83DE6176E55A Mon May 16 15:17:40 2011 panic(cpu 1 caller 0xffffff80002d1208): Kernel trap at 0xffffff80002c3

  • Cannot install CS3 on my new computer

    hi, i cannot install CS3 on my new computer due to the fact that i did not deactivate is on my old laptop. to which i dont have acces any more.. can anyone help finding a solution?

  • Nothing is working after ios6 update...help!

    I have updated my iphone 4s to the IOS6 and now i cant get on itunes,app store, safari, twitter, or facebook. I have also lost 2 bars on my service. I dont know what the **** happened. I have tried doing a hard reset and the recently known date/time

  • Could not load file or assembly

    Hi Guys, I did content migration from wss 3.0 to 2010 share point  i ran test-spcontent database and mount-spcontentdatabase. After fully migrated. once of the site i get following error below , can anyone please help me out. Error Error  Could not l

  • Planned order deletion in mass

    Hi, I want to delete all palnned orders in the plant. Planned order can be deleted using MD16. In MD16, MRP controller is the mandatory field. We can't delete all the planned orders in one stretch in a plant. We can delete the planned orders in a pla