vb script to get machine name and make disable if machine account created under computer OU in AD

Answered vb script to get machine name and make disable if machine account created under computer OU in AD

  • Friday, May 04, 2012 7:28 AM
     
     

    Dear All,

    Pls. help me as i'm required a script or GP to solve below issue.

    Disable the Computer if its hostname not matech with computer object that already created in AD.

    Means: We have make a computer object "LPC-EMPCODE-DP01" but at the time of domain joining engineer will assine some other hostname that is not exist in computer object, so as it join the doman computer object should be disable automatically.


    Milan Tyagi

All Replies

  • Friday, May 04, 2012 10:12 AM
    Moderator
     
     

    This cannot be done by a script.


    Richard Mueller - MVP Directory Services

  • Friday, May 04, 2012 2:08 PM
     
     

    Yeah, the logic is all messed up here.  If the engineer is joining the computer to the domain, the assumption is that the computer is named properly and that the engineer has the rights necessary to actually join the computer to the domain. 

    With that, from the computer/domain perspective, if an administrator is joining the computer to the domain, then the assumption is that the administrator is well-aware of what the computer name is AND that the name is correct.  The domain/computer aren't going to know that the name is wrong -- only the person adding the computer to the domain will.  And because of that, it turns the "auto-disable" request into a "manual-disable" by the engineer/administrator who mistakenly joined the incorrectly-named computer to the domain.

  • Friday, May 04, 2012 2:18 PM
     
     Answered

    A little study on how to create computer accounts would help. 

    We can create an account in advance and set up a user to join a machine only if that user is the owner of the machine and its name matches the predefined account.

    Thsi si not a scripting issue.  It is a server administration issue. You would do better posting in the Windows Server forum for the OS version in question (AD version). 

    You are likely to have many more questions about the correct ways of managing computers in a domain.  Those forums will be very helpful.  Post back when you see a real issue that can be solved by script.


    ¯\_(ツ)_/¯