Active Directory Machine Account Permissions

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Active Directory Machine Account Permissions

    I am creating computer accounts from a web interface and need to set the
    group that has the rights to join the computer to the domain (by default it
    is Domain Admins).

    I can create the accounts, and join them as a domain admin. The problem
    arises when the local administrators who have been delagated control to thier
    OU try to join the computer to the domain. They are recieveing an Account
    Exists error.

    This all works on my test domain with an account I have set up there, but
    fails on the live domain.

    I want to explicity assign Full Control of the computer account object to
    the local admins group for the OU to see if this will fix the problem.

    I have tried to use the NewComputer.ObjectSecurity.AddAccessRule method but
    can't find any documentation on it. (is it part of asp 2.0?)

    Any help is appreciated,

    Jay

    Here is my creation code:

    // Create the new Object
    DirectoryEntry NewComputer = DirLocation.Children.Add("cn=" + MachineName,
    SchemaName);

    // Create Computer Account
    NewComputer.Properties["sAMAccountName"].Add(MachineName + "$");
    NewComputer.Properties["description"].Add(MachDesc);
    NewComputer.Properties["userAccountControl"].Add(AccountControl);

    // Save Computer Account
    NewComputer.CommitChanges();

    // Create routine to set group able to add the computer to the domain
    // as the Designated OU Global Group
    <!-- here is where I am having the problem -->

    NewComputer.Close();

    Jay Armstrong Guest

  2. Similar Questions and Discussions

    1. Account Locked Out - Cold Fusion Application Service running as Active Directory Domain Account
      Using Cold Fusion 7 Standard w/ IIS6. Cold Fusion Application Service is running as a domain account to access IIS home directory on another...
    2. Permissions Issues With ASPNET Account
      For some unexplained reason, I am suddenly unable to browse to a virtual directory on my laptop. I have a number of sample websites to which I could...
    3. Disable account in Active Directory from .NET using DirectoryEntry
      When I try to disable a user account thru forms authentication, I am getting an System.UnauthorizedAccessException: General access denied error. If...
    4. Active Directory Search fails ("The directory service is unavailab
      Hi all, I'm having one of those nerve wrecking errors, when trying to perform a simple search in an Active Directory. The objective of the code...
    5. Permissions for access to Active Directory (CAS)
      Hi! I need to access to Active Directory from Web Servise by DirectoryServices, but at runtime I had SecurityException with message:...
  3. #2

    Default Re: Active Directory Machine Account Permissions

    Did you find a solution for this? I didn't see a reply.

    To modify the security descriptor in .NET 1.1, you need to do COM Interop
    with the IADsSecurityDescriptor. There are samples in the S.DS SDK docs in
    MSDN.

    The ActiveDirectorySecurity stuff is indeed .NET 2.0. It works if you want
    to use the beta or CTP though. :)

    Joe K.

    "Jay Armstrong" <JayArmstrong@discussions.microsoft.com> wrote in message
    news:37422076-E5D3-451A-B85F-8F73FBFD26C9@microsoft.com...
    >I am creating computer accounts from a web interface and need to set the
    > group that has the rights to join the computer to the domain (by default
    > it
    > is Domain Admins).
    >
    > I can create the accounts, and join them as a domain admin. The problem
    > arises when the local administrators who have been delagated control to
    > thier
    > OU try to join the computer to the domain. They are recieveing an Account
    > Exists error.
    >
    > This all works on my test domain with an account I have set up there, but
    > fails on the live domain.
    >
    > I want to explicity assign Full Control of the computer account object to
    > the local admins group for the OU to see if this will fix the problem.
    >
    > I have tried to use the NewComputer.ObjectSecurity.AddAccessRule method
    > but
    > can't find any documentation on it. (is it part of asp 2.0?)
    >
    > Any help is appreciated,
    >
    > Jay
    >
    > Here is my creation code:
    >
    > // Create the new Object
    > DirectoryEntry NewComputer = DirLocation.Children.Add("cn=" + MachineName,
    > SchemaName);
    >
    > // Create Computer Account
    > NewComputer.Properties["sAMAccountName"].Add(MachineName + "$");
    > NewComputer.Properties["description"].Add(MachDesc);
    > NewComputer.Properties["userAccountControl"].Add(AccountControl);
    >
    > // Save Computer Account
    > NewComputer.CommitChanges();
    >
    > // Create routine to set group able to add the computer to the domain
    > // as the Designated OU Global Group
    > <!-- here is where I am having the problem -->
    >
    > NewComputer.Close();
    >

    Joe Kaplan \(MVP - ADSI\) Guest

  4. #3

    Default Re: Active Directory Machine Account Permissions

    Joe,

    Thanks for the feedback. Unfortunately I cannot run 2.0 on my production
    servers, so I will have to wait for the AD security code.

    We tracked it down to a rights assignment not taking. After removing the
    delegation and recreating it, the remote admins could join the machines to
    the domain.

    We would still like to explicitly assign the rights to the groups, but I
    (still) can't find the examples you mention in the MSDN. Do you have a link?

    Jay

    "Joe Kaplan (MVP - ADSI)" wrote:
    > Did you find a solution for this? I didn't see a reply.
    >
    > To modify the security descriptor in .NET 1.1, you need to do COM Interop
    > with the IADsSecurityDescriptor. There are samples in the S.DS SDK docs in
    > MSDN.
    >
    > The ActiveDirectorySecurity stuff is indeed .NET 2.0. It works if you want
    > to use the beta or CTP though. :)
    >
    > Joe K.
    >
    > "Jay Armstrong" <JayArmstrong@discussions.microsoft.com> wrote in message
    > news:37422076-E5D3-451A-B85F-8F73FBFD26C9@microsoft.com...
    > >I am creating computer accounts from a web interface and need to set the
    > > group that has the rights to join the computer to the domain (by default
    > > it
    > > is Domain Admins).
    > >
    > > I can create the accounts, and join them as a domain admin. The problem
    > > arises when the local administrators who have been delagated control to
    > > thier
    > > OU try to join the computer to the domain. They are recieveing an Account
    > > Exists error.
    > >
    > > This all works on my test domain with an account I have set up there, but
    > > fails on the live domain.
    > >
    > > I want to explicity assign Full Control of the computer account object to
    > > the local admins group for the OU to see if this will fix the problem.
    > >
    > > I have tried to use the NewComputer.ObjectSecurity.AddAccessRule method
    > > but
    > > can't find any documentation on it. (is it part of asp 2.0?)
    > >
    > > Any help is appreciated,
    > >
    > > Jay
    > >
    > > Here is my creation code:
    > >
    > > // Create the new Object
    > > DirectoryEntry NewComputer = DirLocation.Children.Add("cn=" + MachineName,
    > > SchemaName);
    > >
    > > // Create Computer Account
    > > NewComputer.Properties["sAMAccountName"].Add(MachineName + "$");
    > > NewComputer.Properties["description"].Add(MachDesc);
    > > NewComputer.Properties["userAccountControl"].Add(AccountControl);
    > >
    > > // Save Computer Account
    > > NewComputer.CommitChanges();
    > >
    > > // Create routine to set group able to add the computer to the domain
    > > // as the Designated OU Global Group
    > > <!-- here is where I am having the problem -->
    > >
    > > NewComputer.Close();
    > >
    >
    >
    >
    Jay Armstrong Guest

  5. #4

    Default Re: Active Directory Machine Account Permissions

    This is the only SDS-specific sample:

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/security_descriptor_property_type.asp?frame=true[/url]

    The real body of the security stuff is in the AD SDK. You essentially need
    to translate those from ADSI to SDS, but they are essentially the same.
    They start here (probably read the whole thing twice :)):

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/controlling_access_to_active_directory_objects.asp ?frame=true[/url]

    Generally, I try to avoid doing this stuff in code as much as possible as it
    kind of sucks. However, when forced to do it, I generally try making the
    changes in the UI first, dump out the resulting SD in code, then try to make
    the same changes in code to get it working. If you need to play with the
    inheritance settings, you need to mess with the flags (the "protected" flag
    specifically) on the Control member on the SD.

    Best of luck. I'm sure you'll get this working eventually.

    Joe K.

    "Jay Armstrong" <JayArmstrong@discussions.microsoft.com> wrote in message
    news:194459E4-4FC6-47C5-B210-CF2C75931770@microsoft.com...
    > Joe,
    >
    > Thanks for the feedback. Unfortunately I cannot run 2.0 on my production
    > servers, so I will have to wait for the AD security code.
    >
    > We tracked it down to a rights assignment not taking. After removing the
    > delegation and recreating it, the remote admins could join the machines to
    > the domain.
    >
    > We would still like to explicitly assign the rights to the groups, but I
    > (still) can't find the examples you mention in the MSDN. Do you have a
    > link?
    >
    > Jay
    >
    > "Joe Kaplan (MVP - ADSI)" wrote:
    >
    >> Did you find a solution for this? I didn't see a reply.
    >>
    >> To modify the security descriptor in .NET 1.1, you need to do COM Interop
    >> with the IADsSecurityDescriptor. There are samples in the S.DS SDK docs
    >> in
    >> MSDN.
    >>
    >> The ActiveDirectorySecurity stuff is indeed .NET 2.0. It works if you
    >> want
    >> to use the beta or CTP though. :)
    >>
    >> Joe K.
    >>
    >> "Jay Armstrong" <JayArmstrong@discussions.microsoft.com> wrote in message
    >> news:37422076-E5D3-451A-B85F-8F73FBFD26C9@microsoft.com...
    >> >I am creating computer accounts from a web interface and need to set the
    >> > group that has the rights to join the computer to the domain (by
    >> > default
    >> > it
    >> > is Domain Admins).
    >> >
    >> > I can create the accounts, and join them as a domain admin. The problem
    >> > arises when the local administrators who have been delagated control to
    >> > thier
    >> > OU try to join the computer to the domain. They are recieveing an
    >> > Account
    >> > Exists error.
    >> >
    >> > This all works on my test domain with an account I have set up there,
    >> > but
    >> > fails on the live domain.
    >> >
    >> > I want to explicity assign Full Control of the computer account object
    >> > to
    >> > the local admins group for the OU to see if this will fix the problem.
    >> >
    >> > I have tried to use the NewComputer.ObjectSecurity.AddAccessRule method
    >> > but
    >> > can't find any documentation on it. (is it part of asp 2.0?)
    >> >
    >> > Any help is appreciated,
    >> >
    >> > Jay
    >> >
    >> > Here is my creation code:
    >> >
    >> > // Create the new Object
    >> > DirectoryEntry NewComputer = DirLocation.Children.Add("cn=" +
    >> > MachineName,
    >> > SchemaName);
    >> >
    >> > // Create Computer Account
    >> > NewComputer.Properties["sAMAccountName"].Add(MachineName + "$");
    >> > NewComputer.Properties["description"].Add(MachDesc);
    >> > NewComputer.Properties["userAccountControl"].Add(AccountControl);
    >> >
    >> > // Save Computer Account
    >> > NewComputer.CommitChanges();
    >> >
    >> > // Create routine to set group able to add the computer to the domain
    >> > // as the Designated OU Global Group
    >> > <!-- here is where I am having the problem -->
    >> >
    >> > NewComputer.Close();
    >> >
    >>
    >>
    >>

    Joe Kaplan \(MVP - ADSI\) Guest

  6. #5

    Default Re: Active Directory Machine Account Permissions

    That looks like it will do it! Thanks. Good to know there are people like you
    out there to help.

    I've done some of this in vbscript, but C# and .NET are new animals to me. I
    can get an ASP.NET website up and running, but the advanced stuff is still up
    the learning curve.

    I have some reading to do.

    Jay

    "Joe Kaplan (MVP - ADSI)" wrote:
    > This is the only SDS-specific sample:
    >
    > [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/security_descriptor_property_type.asp?frame=true[/url]
    >
    > The real body of the security stuff is in the AD SDK. You essentially need
    > to translate those from ADSI to SDS, but they are essentially the same.
    > They start here (probably read the whole thing twice :)):
    >
    > [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/controlling_access_to_active_directory_objects.asp ?frame=true[/url]
    >
    > Generally, I try to avoid doing this stuff in code as much as possible as it
    > kind of sucks. However, when forced to do it, I generally try making the
    > changes in the UI first, dump out the resulting SD in code, then try to make
    > the same changes in code to get it working. If you need to play with the
    > inheritance settings, you need to mess with the flags (the "protected" flag
    > specifically) on the Control member on the SD.
    >
    > Best of luck. I'm sure you'll get this working eventually.
    >
    > Joe K.
    >
    > "Jay Armstrong" <JayArmstrong@discussions.microsoft.com> wrote in message
    > news:194459E4-4FC6-47C5-B210-CF2C75931770@microsoft.com...
    > > Joe,
    > >
    > > Thanks for the feedback. Unfortunately I cannot run 2.0 on my production
    > > servers, so I will have to wait for the AD security code.
    > >
    > > We tracked it down to a rights assignment not taking. After removing the
    > > delegation and recreating it, the remote admins could join the machines to
    > > the domain.
    > >
    > > We would still like to explicitly assign the rights to the groups, but I
    > > (still) can't find the examples you mention in the MSDN. Do you have a
    > > link?
    > >
    > > Jay
    > >
    > > "Joe Kaplan (MVP - ADSI)" wrote:
    > >
    > >> Did you find a solution for this? I didn't see a reply.
    > >>
    > >> To modify the security descriptor in .NET 1.1, you need to do COM Interop
    > >> with the IADsSecurityDescriptor. There are samples in the S.DS SDK docs
    > >> in
    > >> MSDN.
    > >>
    > >> The ActiveDirectorySecurity stuff is indeed .NET 2.0. It works if you
    > >> want
    > >> to use the beta or CTP though. :)
    > >>
    > >> Joe K.
    > >>
    > >> "Jay Armstrong" <JayArmstrong@discussions.microsoft.com> wrote in message
    > >> news:37422076-E5D3-451A-B85F-8F73FBFD26C9@microsoft.com...
    > >> >I am creating computer accounts from a web interface and need to set the
    > >> > group that has the rights to join the computer to the domain (by
    > >> > default
    > >> > it
    > >> > is Domain Admins).
    > >> >
    > >> > I can create the accounts, and join them as a domain admin. The problem
    > >> > arises when the local administrators who have been delagated control to
    > >> > thier
    > >> > OU try to join the computer to the domain. They are recieveing an
    > >> > Account
    > >> > Exists error.
    > >> >
    > >> > This all works on my test domain with an account I have set up there,
    > >> > but
    > >> > fails on the live domain.
    > >> >
    > >> > I want to explicity assign Full Control of the computer account object
    > >> > to
    > >> > the local admins group for the OU to see if this will fix the problem.
    > >> >
    > >> > I have tried to use the NewComputer.ObjectSecurity.AddAccessRule method
    > >> > but
    > >> > can't find any documentation on it. (is it part of asp 2.0?)
    > >> >
    > >> > Any help is appreciated,
    > >> >
    > >> > Jay
    > >> >
    > >> > Here is my creation code:
    > >> >
    > >> > // Create the new Object
    > >> > DirectoryEntry NewComputer = DirLocation.Children.Add("cn=" +
    > >> > MachineName,
    > >> > SchemaName);
    > >> >
    > >> > // Create Computer Account
    > >> > NewComputer.Properties["sAMAccountName"].Add(MachineName + "$");
    > >> > NewComputer.Properties["description"].Add(MachDesc);
    > >> > NewComputer.Properties["userAccountControl"].Add(AccountControl);
    > >> >
    > >> > // Save Computer Account
    > >> > NewComputer.CommitChanges();
    > >> >
    > >> > // Create routine to set group able to add the computer to the domain
    > >> > // as the Designated OU Global Group
    > >> > <!-- here is where I am having the problem -->
    > >> >
    > >> > NewComputer.Close();
    > >> >
    > >>
    > >>
    > >>
    >
    >
    >
    Jay Armstrong Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139