Quantcast
Channel: Hyper-V forum
Viewing all articles
Browse latest Browse all 8743

Sysprep: AutoLogon and SynchronousCommand

$
0
0

Hi All,

Currently trying to create an Sysprep image for a Hyper-V 2012 deployment. I need to execute two Powershell scripts as part of the image with the execution policy set to unrestricted (or remote signed?). One to change the computername to match the VM name, and also a script that prompts the user to input an IPv4 address. Both these scripts work when executed manually.

These scripts to not appear to be being executed as part of the Sysprep image deployment. Being pretty new to Sysprep I'm getting a bit lost and short of time. Below is a copy of my unattend.xml file (with sensitive bits changed) and was hoping someone might be able to point out where I'm going wrong (and hopefully offer a solution).

<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend"><settings pass="oobeSystem"><component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><InputLocale>en-US</InputLocale><SystemLocale>en-US</SystemLocale><UILanguage>en-US</UILanguage><UILanguageFallback>en-US</UILanguageFallback><UserLocale>en-US</UserLocale></component><component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><OOBE><HideEULAPage>true</HideEULAPage><NetworkLocation>Work</NetworkLocation><ProtectYourPC>1</ProtectYourPC></OOBE><TimeZone>Pacific Standard Time</TimeZone></component></settings><settings pass="specialize"><component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ProductKey>XXXX-XXXX-XXXX-XXXX</ProductKey><CopyProfile>true</CopyProfile><UserAccounts><AdministratorPassword><Value>TestPassword</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts> <AutoLogon><Password><Value>TestPassword</Value><PlainText>true</PlainText></Password><Username>Administrator</Username><LogonCount>1</LogonCount><Enabled>true</Enabled></AutoLogon><FirstLogonCommands><SynchronousCommand wcm:action="add"><Order>1</Order><CommandLine>%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe -command set-executionpolicy remotesigned -force >> C:\Users\Public\Documents\setExecution.log</CommandLine><Description>Set the ExecutionPolicy to RemoteSigned for the setup script to run</Description></SynchronousCommand><SynchronousCommand wcm:action="add"><Order>2</Order><CommandLine>%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe -command "C:\Setup\Rename.ps1"</CommandLine><Description>Rename Computername to match VM name</Description></SynchronousCommand><SynchronousCommand wcm:action="add"><Order>3</Order><CommandLine>%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe -command "C:\Setup\AssignIP.ps1"</CommandLine><Description>Configure Networking</Description></SynchronousCommand></FirstLogonCommands></component></settings></unattend>




Viewing all articles
Browse latest Browse all 8743

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>