harshkapadia
New member
Hello,
I am creating Windows 11 Pro VMs the unattended way using
My user is part of the 'Administrators' group and the 'EnableLUA' registry setting is set to disable (
I tried various things with varying levels of success:
I am creating Windows 11 Pro VMs the unattended way using
autounattend.xml
. I am able to successfully install Windows. I am now trying to map a NAS/network share persistently on startup and am also trying to install some software on startup, but am unable to. I either get an error or the commands just silently fail to run, without any errors in setuperr.log
or setupact.log
. Any help to be able to run these commands would be appreciated. Thank you!My user is part of the 'Administrators' group and the 'EnableLUA' registry setting is set to disable (
0
).I tried various things with varying levels of success:
- I ran a script (
mk-dir-test-2.cmd
) from a network share which just creates a directory in the Downloads directory.- This works fine and I am able to see a new directory in the Downloads directory after the first log on completes.
- I ran a script (
system-setup-test.cmd
) from the same network share as above which downloads PuTTY from Winget and then uses PuTTY toscp
a file from the network share to the Windows VM.- This gives me a 'Open File - Security Warning' which asks the user to allow the script to run. On giving permission, the script runs fine, but I don't want to have user interaction.
- The weird part is that I run this script after the script mentioned in the previous bullet point (the script that just creates a directory in the Downloads directory) and even thought the previous script runs fine, this one has issues.
- So the issue in my understanding should not be that Windows does not trust the network share. If it had trust issues, then why would the first directory script fetched from the same network share succeed?
- This gives me a 'Open File - Security Warning' which asks the user to allow the script to run. On giving permission, the script runs fine, but I don't want to have user interaction.
- I also ran a script (
copy-file.cmd
) that first persistently maps a network share and then copies a file from the mapped drive to the VM for execution.- This has the same issue as the previous bullet point.
autounattend.xml
:
XML:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" 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">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
<component name="Microsoft-Windows-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">
<DiskConfiguration>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>450</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Size>100</Size>
<Type>EFI</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>3</Order>
<Size>16</Size>
<Type>MSR</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>4</Order>
<Extend>true</Extend>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>
<Format>NTFS</Format>
<Label>WinRE</Label>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Format>FAT32</Format>
<Label>System</Label>
<Order>2</Order>
<PartitionID>2</PartitionID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<PartitionID>3</PartitionID>
<Order>3</Order>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Order>4</Order>
<Letter>C</Letter>
<PartitionID>4</PartitionID>
<Label>Windows</Label>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
<WillShowUI>OnError</WillShowUI>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>4</PartitionID>
</InstallTo>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/INDEX</Key>
<Value>6</Value>
</MetaData>
</InstallFrom>
<WillShowUI>OnError</WillShowUI>
</OSImage>
</ImageInstall>
<UserData>
<ProductKey>
<Key></Key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
<FullName>redacted</FullName>
<Organization>redacted</Organization>
</UserData>
</component>
</settings>
<settings pass="offlineServicing">
<component name="Microsoft-Windows-LUA-Settings" 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">
<EnableLUA>false</EnableLUA>
</component>
</settings>
<settings pass="generalize">
<component name="Microsoft-Windows-Security-SPP" 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">
<SkipRearm>1</SkipRearm>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Security-SPP-UX" 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">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-SQMApi" 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">
<CEIPEnabled>0</CEIPEnabled>
</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">
<ComputerName>redacted</ComputerName>
</component>
</settings>
<settings pass="oobeSystem">
<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">
<AutoLogon>
<Password>
<Value>redacted</Value>
<PlainText>false</PlainText>
</Password>
<Username>redacted</Username>
<Enabled>true</Enabled>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<ProtectYourPC>3</ProtectYourPC>
<UnattendEnableRetailDemo>false</UnattendEnableRetailDemo>
</OOBE>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>redacted</Value>
<PlainText>false</PlainText>
</Password>
<Description>Primary Local Account</Description>
<DisplayName>redacted</DisplayName>
<Group>Administrators</Group>
<Name>redacted</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>\\redacted\copy-file.cmd</CommandLine>
<Description>system-setup</Description>
<Order>2</Order>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<RequiresUserInput>false</RequiresUserInput>
<Description>mkdir-test</Description>
<CommandLine>\\redacted\mk-dir-test-2.cmd</CommandLine>
</SynchronousCommand>
</FirstLogonCommands>
</component>
<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>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:c:/users/redacted/downloads/windows-iso-files/win11_23h2_english_x64v2-10/sources/install.wim#Windows 11 Pro" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
copy-file.cmd
:
Batch:
mkdir C:\Users\redacted\Downloads\test-dir-3
NET USE X: \\redacted /persistent:yes
mkdir C:\Users\redacted\Downloads\test-dir-4
cp X:/redacted/system-setup-test.cmd C:/Users/redacted/Downloads
mkdir C:\Users\redacted\Downloads\test-dir-5
C:/Users/redacted/Downloads/system-setup-test.cmd
mkdir C:\Users\redacted\Downloads\test-dir-6
mk-dir-test-2.cmd
:
Batch:
mkdir C:\Users\redacted\Downloads\test-dir-2
system-setup-test.cmd
:
Batch:
winget install PuTTY --source msstore --accept-source-agreements --accept-package-agreements
echo y | C:\"Program Files"\PuTTY\pscp.exe -pw redacted -r redacted@redacted:/mnt/redacted/kvm-scripts C:\Users\redacted\Downloads
My Computer
System One
-
- OS
- Windows 11
- Computer type
- Laptop
- Manufacturer/Model
- Dell Vostro