none
UnjoinDomainOrWorkgroup does not work on Windows 7 RRS feed

  • Question

  • Hi All

    I need to write a script which is compatible on XP (32bit) and 7 (64bit) which does the following:
    (Credentials will be hardcoded and the script will converted to EXE)

    1. Join to a domain  and add a domain user to local admin group
    2. Disjoin from domain
    3. Rename a machine in domain

    I somehow managed to do the 1st one. But i am unable to do the 2nd and 3rd.
    UnjoinDomainOrWorkgroup is not working on Windows 7.

    I am not using Netdom for the following reasons:
    1. there are different version for 64bit and 32bit and getting them is a pain... i mean need to get them from RSAT and resource kit
    2. I do not know how to get the error codes from dos and validate them in VBscript. Hence cannot make the script interactive

    What i noticed with UnjoinDomainOrWorkgroup is that
    objComputer.UnjoinDomainOrWorkgroup (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)    - Does not work, but
    objComputer.UnjoinDomainOrWorkgroup (NETSETUP_ACCT_DELETE)    - this works but, it does not disable the Computer account.

    Is there any way to accomplish the above tasks using scripts.

    Note that these scripts will be run a newly deployed machines before giving it to the user

    Thursday, November 4, 2010 3:08 PM

Answers

  • Hi,

    For script problem, you can ask Scripting Forum:

    The Official Scripting Guys Forum! Forum

    ·         The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.  Thank you for your understanding.

     

    Regards,

    Leo   Huang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by kantzy Monday, November 8, 2010 7:39 AM
    Monday, November 8, 2010 5:39 AM
    Moderator

All replies

  • Hi,

    For script problem, you can ask Scripting Forum:

    The Official Scripting Guys Forum! Forum

    ·         The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.  Thank you for your understanding.

     

    Regards,

    Leo   Huang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by kantzy Monday, November 8, 2010 7:39 AM
    Monday, November 8, 2010 5:39 AM
    Moderator
  • I apologize for posting it here.

    Thanks
    kantzy

    Monday, November 8, 2010 7:40 AM