none
Setting admin password in TS

    Question

  • I have seen some similar posts but nothing that addresses my specific issue

    I want to set the local admin password randomly during my TS or at the end,  this value will be sent to a password safe for later use.

    I have tried setting the built-in admin password CS variable in code but that variable seems to be taken over by the task sequence.  So I am now using my own ts variable and set the password as one of the last steps in the TS.

    This appears to be being reset by the TS to something else though.

    Question is where can I run this task in the TS so that it is what I want it set it to. 

    Friday, February 01, 2013 9:55 PM

Answers

  • You should use the "AdminPassword" variable.  You can set it at the beginning of your Task Sequence and it will be used later appropriately.  You could set it with a VBScript or something to randomly set it (per some format, scheme, or pattern) and then to check it into your password safe or however you are keeping track of it.  For a good example of how to set variables with VBScript, see Andrews blog (http://scriptimus.wordpress.com/2012/04/16/mdt-scripting-using-vbscript-expressions-in-customsettings-ini-file/).

    David Coulter | http://DCtheGeek.blogspot.com | @DCtheGeek

    • Marked as answer by f63457 Monday, February 04, 2013 8:23 PM
    Friday, February 01, 2013 11:44 PM
    Answerer
  • ok,  I re-did my task setting the adminpasswod TS variable in code.  This time I saved it out to another variable as well.  The adminpassword is getting taken over by the TS at some point.  My password did get set to what I wanted but when I write out the adminpassword variable later in the TS it is different.  Not sure why this is happening,  I assume that the TS is taking it over to randomly set it for each auto logon and setting it back to the static string at the end.  Regardless two variables seem to be required for this type of work flow
    • Marked as answer by f63457 Monday, February 04, 2013 8:22 PM
    Monday, February 04, 2013 8:20 PM

All replies

  • You should use the "AdminPassword" variable.  You can set it at the beginning of your Task Sequence and it will be used later appropriately.  You could set it with a VBScript or something to randomly set it (per some format, scheme, or pattern) and then to check it into your password safe or however you are keeping track of it.  For a good example of how to set variables with VBScript, see Andrews blog (http://scriptimus.wordpress.com/2012/04/16/mdt-scripting-using-vbscript-expressions-in-customsettings-ini-file/).

    David Coulter | http://DCtheGeek.blogspot.com | @DCtheGeek

    • Marked as answer by f63457 Monday, February 04, 2013 8:23 PM
    Friday, February 01, 2013 11:44 PM
    Answerer
  • I had tried that,  I will try again. 

    As a test I was writing the string out at a later step and noticed it had changed by the TS.  I didn't know the actual string but my random function was set to return 8 characters, the string from the adminpassword variable was longer.  I could not login with that password.  Basically in this order is what I need to happen

    1. password created and stored in a ts variable or adminpassword
    2. ts Variable read and then written to password safe, txt or where ever
    3. variable used by built in mdt process to set the password.

    do you happen to know when 3 actually occurs in the TS?

    Saturday, February 02, 2013 12:27 AM
  • and I am doing a lot of customization in the ui and with variables that are all working correctly so I know my code is good.  I just feel like my data is being hijacked
    Saturday, February 02, 2013 12:29 AM
  • I believe it's handled by the Unattend.xml for your Task Sequence.  Maybe try putting %AdminPassword% into the <AdministratorPassword><Value></Value></AdministratorPassword> node?  I thought MDT would do this automatically for you when applying the WIM, maybe your Task Sequence has a password set and it's got a value in Unattend.xml and is overriding what you are passing to it with the variable?

    David Coulter | http://DCtheGeek.blogspot.com | @DCtheGeek

    Saturday, February 02, 2013 12:51 AM
    Answerer
  • ok,  I re-did my task setting the adminpasswod TS variable in code.  This time I saved it out to another variable as well.  The adminpassword is getting taken over by the TS at some point.  My password did get set to what I wanted but when I write out the adminpassword variable later in the TS it is different.  Not sure why this is happening,  I assume that the TS is taking it over to randomly set it for each auto logon and setting it back to the static string at the end.  Regardless two variables seem to be required for this type of work flow
    • Marked as answer by f63457 Monday, February 04, 2013 8:22 PM
    Monday, February 04, 2013 8:20 PM
  • When you created the TS did you set the admin password (in the wizard)?  This saves it into the Unattend.xml, which I believe will overwrite it...
    Monday, February 04, 2013 9:23 PM