Hello. I have created an unattend answer file to be used with a windows 10 image and I am experiencing an issue. I have placed a powershell command under the "FirstLogonCommands" but it is never run. Here is my answer file:
<?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-International-Core" processorArchitecture="x86" 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>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<ProtectYourPC>1</ProtectYourPC>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
</OOBE>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>Powershell -Command "Set-ExecutionPolicy RemoteSigned -Force; $LanguageList = Get-WinUserLanguageList; $LanguageList.Add('el-GR'); Set-WinUserLanguageList $LanguageList -Force; tzutil /s 'GTB Standard Time'; set-culture en-GB; Powercfg /Change standby-timeout-ac 0; Powercfg /Change standby-timeout-dc 0;"</CommandLine>
<Description>Add Greek language to input languages, Set time zone to UTC+02:00, Set region to en-GB (User Locale), Change Sleep settings to "Never"</Description>
<Order>1</Order>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
</FirstLogonCommands>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" 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>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<ProtectYourPC>1</ProtectYourPC>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
</OOBE>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>Powershell -Command "Set-ExecutionPolicy RemoteSigned -Force; $LanguageList = Get-WinUserLanguageList; $LanguageList.Add('el-GR'); Set-WinUserLanguageList $LanguageList -Force; tzutil /s 'GTB Standard Time'; set-culture en-GB; Powercfg /Change standby-timeout-ac 0; Powercfg /Change standby-timeout-dc 0;"</CommandLine>
<Description>Add Greek language to input languages, Set time zone to UTC+02:00, Set region to en-GB (User Locale), Change Sleep settings to "Never"</Description>
<Order>1</Order>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
</unattend>
What bothers me is, that when I manually run that command after OOBE finishes, the command is executed perfectly.
I have also tried replacing that command with:
1. cmd.exe /c powershell -command "COMMANDS"
2. powershell .exe COMMANDS (without quotes)
3. %WINDIR%\System32\cmd.exe /c powershell -Command "COMMANDS"
4. %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe COMMANDS (without quotes)
Nothing seems to work and I cannot understand why. All the other sections in the answer file are processed correctly without any issues. Also, I am trying to avoid creating a batch file that has the script inside, since I only want to use just one answer file to execute a simple powershell command.
Any help would be highly appreciated. Thanks.