lx.josh Posted November 5, 2013 Report Share Posted November 5, 2013 Is there a way to have the machine Auto Logon Once as Administrator after Deployment? I want to have it logon automatically so that my post logon tasks can be automated. Link to comment Share on other sites More sharing options...
Chatham Posted November 5, 2013 Report Share Posted November 5, 2013 Yeah it can. With SmartDeploy support help I managed to do it for me. Here are the steps you need to perform to make it work: 1. Create a vbs script and call it, for instance, autoadmin.vbs 2. The code is below: UpdateXML "T:\windows\panther\unattend.xml" UpdateXML "T:\windows\system32\sysprep\unattend.xml" Sub UpdateXML(xmlFile) Set xmlUnattendFile = CreateObject("MSXML2.DOMDocument.6.0") xmlUnattendFile.Async = "False" blnLoaded = xmlUnattendFile.Load(xmlFile) If (blnLoaded) And (xmlUnattendFile.parseError.errorCode = 0) Then xmlUnattendFile.setProperty "SelectionNamespaces", "xmlns:ns='urn:schemas-microsoft-com:unattend'" Set objXmlNode = xmlUnattendFile.selectSingleNode("//ns:settings[@pass='oobeSystem']/ns:component[@name='Microsoft-Windows-Shell-Setup']") If Not (objXmlNode Is Nothing) Then 'create the AutoLogon node Set objXmlElement = xmlUnattendFile.createNode(1, "AutoLogon", "urn:schemas-microsoft-com:unattend") objXmlNode.appendChild(objXmlElement) 'select it Set objXmlNode = xmlUnattendFile.selectSingleNode("//ns:component[@name='Microsoft-Windows-Shell-Setup']/ns:AutoLogon") 'create the Password node and elements Set objXmlElement = xmlUnattendFile.createNode(1, "Password", "urn:schemas-microsoft-com:unattend") objXmlNode.appendChild(objXmlElement) Set objXmlNode = xmlUnattendFile.selectSingleNode("//ns:AutoLogon/ns:Password") Set objXmlElement = xmlUnattendFile.createNode(1, "Value", "urn:schemas-microsoft-com:unattend") 'put your admins password below objXmlElement.Text = "PASSWORD_GOES_HERE" objXmlNode.appendChild(objXmlElement) Set objXmlElement = xmlUnattendFile.createNode(1, "PlainText", "urn:schemas-microsoft-com:unattend") objXmlElement.Text = "True" objXmlNode.appendChild(objXmlElement) 'select the AutoLogon node and create elements Set objXmlNode = xmlUnattendFile.selectSingleNode("//ns:component[@name='Microsoft-Windows-Shell-Setup']/ns:AutoLogon") Set objXmlElement = xmlUnattendFile.createNode(1, "Enabled", "urn:schemas-microsoft-com:unattend") objXmlElement.Text = "true" objXmlNode.appendChild(objXmlElement) Set objXmlElement = xmlUnattendFile.createNode(1, "LogonCount", "urn:schemas-microsoft-com:unattend") 'below put the number of how many times the account should log in automatically objXmlElement.Text = "1" objXmlNode.appendChild(objXmlElement) Set objXmlElement = xmlUnattendFile.createNode(1, "Username", "urn:schemas-microsoft-com:unattend") 'put the account name in you want to autologon objXmlElement.Text = "Administrator" objXmlNode.appendChild(objXmlElement) 'save it xmlUnattendFile.Save(xmlFile) End If End If End Sub Make sure you set your admins password, logon count (how many times you want your admin acc to log on after consecutive logons and reboots) and the actual account name, which is administrator in the code but you can put another account if you have any. 3. When using Media Wizard, on the screen where you can select a folder with more files to attach to the image, browse to the folder where you put the autoadmin.vbs script so it gets copied over to the image. IMPORTANT: If you are going to use the WDS deployment with PXE boot and your image will be a WIM image, not a ISO image, your files WILL NOT get copied over to the image (I hope admins will make sure they fix that so both ISO and WIM images are the same). In order to copy those files over to a WIM file, you will need to use IMAGEX.EXE program to mount, create folders and copy autoadmin.vbs script and commit changes to the WIM image. If you decide to go for that, let me know, I'll help you out. 4. Create a task in the deployment wizard and: - set it as POSTIMAGE (after the image has been deployed) - command line is: Wscript.exe X:\z\Scripts\autoadmin.vbs If you wish to modify an existing answer file, just add the below lines: <task> <phase>POSTIMAGE</phase> <command>Wscript.exe X:\z\scripts\autoadmin.vbs</command> </task> This worked for me. Hope it helps. Let me know if I can help you out more. Jakub Link to comment Share on other sites More sharing options...
eturner Posted March 28, 2016 Report Share Posted March 28, 2016 Is there a way to add one more reboot or logoff to this script? Have it so that it logs on twice as admin to install programs, but am planning on having someone different log in after the process is done and would like to have them back at the logon screen. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now