Giter VIP home page Giter VIP logo

unattend-generator's Introduction

unattend-generator's People

Contributors

cschneegans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

unattend-generator's Issues

Word limit?

I was trying to add some registry tweaks under: "Scripts to run in the system context, before user accounts are created" section, and after the content reaches to 15593 characters (with spaces), 426 lines, I can't put more into it. Just want to check if there is a word limit there?

there is too much useless information

there is too much in your form

there is no need for that much

the rest is configured in the OEM setup

whether in the form or in the output file

there is too much useless information

there is no need for so much in it in my case here is what generated 132 lines for me

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
	<!--https://schneegans.de/windows/unattend-generator/?LanguageMode=Unattended&UILanguage=fr-FR&UserLocale=fr-FR&KeyboardLayout=040c%3A0000040c&GeoLocation=84&ProcessorArchitecture=x86&ComputerNameMode=Random&TimeZoneMode=Implicit&PartitionMode=Interactive&WindowsEditionMode=Unattended&WindowsEdition=pro&UserAccountMode=Unattended&AccountName0=Admin&AccountPassword0=password&AccountGroup0=Administrators&AccountName1=User&AccountPassword1=password&AccountGroup1=Users&AutoLogonMode=Own&PasswordExpirationMode=Unlimited&LockoutMode=Default&VBoxGuestAdditions=true&WifiMode=Skip&ExpressSettings=DisableAll&WdacMode=Skip-->
	<settings pass="offlineServicing"></settings>
	<settings pass="windowsPE">
		<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
			<SetupUILanguage>
				<UILanguage>fr-FR</UILanguage>
			</SetupUILanguage>
			<InputLocale>040c:0000040c</InputLocale>
			<SystemLocale>fr-FR</SystemLocale>
			<UILanguage>fr-FR</UILanguage>
			<UserLocale>fr-FR</UserLocale>
		</component>
		<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
			<UserData>
				<ProductKey>
					<Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key>
				</ProductKey>
				<AcceptEula>true</AcceptEula>
			</UserData>
		</component>
	</settings>
	<settings pass="generalize"></settings>
	<settings pass="specialize">
		<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
			<RunSynchronous>
				<RunSynchronousCommand wcm:action="add">
					<Order>1</Order>
					<Path>net.exe accounts /maxpwage:UNLIMITED</Path>
				</RunSynchronousCommand>
				<RunSynchronousCommand wcm:action="add">
					<Order>2</Order>
					<Path>powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;"</Path>
				</RunSynchronousCommand>
				<RunSynchronousCommand wcm:action="add">
					<Order>3</Order>
					<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath '%TEMP%\VBoxGuestAdditions.ps1' -Raw | Invoke-Expression;"</Path>
				</RunSynchronousCommand>
			</RunSynchronous>
		</component>
	</settings>
	<settings pass="auditSystem"></settings>
	<settings pass="auditUser"></settings>
	<settings pass="oobeSystem">
		<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
			<InputLocale>040c:0000040c</InputLocale>
			<SystemLocale>fr-FR</SystemLocale>
			<UILanguage>fr-FR</UILanguage>
			<UserLocale>fr-FR</UserLocale>
		</component>
		<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
			<UserAccounts>
				<LocalAccounts>
					<LocalAccount wcm:action="add">
						<Name>Admin</Name>
						<Group>Administrators</Group>
						<Password>
							<Value>password</Value>
							<PlainText>true</PlainText>
						</Password>
					</LocalAccount>
					<LocalAccount wcm:action="add">
						<Name>User</Name>
						<Group>Users</Group>
						<Password>
							<Value>password</Value>
							<PlainText>true</PlainText>
						</Password>
					</LocalAccount>
				</LocalAccounts>
			</UserAccounts>
			<AutoLogon>
				<Username>Admin</Username>
				<Enabled>true</Enabled>
				<LogonCount>1</LogonCount>
				<Password>
					<Value>password</Value>
					<PlainText>true</PlainText>
				</Password>
			</AutoLogon>
			<OOBE>
				<ProtectYourPC>3</ProtectYourPC>
				<HideEULAPage>true</HideEULAPage>
				<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
			</OOBE>
			<FirstLogonCommands>
				<SynchronousCommand wcm:action="add">
					<Order>1</Order>
					<CommandLine>reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_DWORD /d 0 /f</CommandLine>
				</SynchronousCommand>
			</FirstLogonCommands>
		</component>
	</settings>
	<Extensions xmlns="https://schneegans.de/windows/unattend-generator/">
		<ExtractScript>
param(
    [xml] $Document
);

$scriptsDir = 'C:\Windows\Setup\Scripts\';
foreach( $file in $Document.unattend.Extensions.File ) {
    $path = [System.Environment]::ExpandEnvironmentVariables(
        $file.GetAttribute( 'path' )
    );
    if( $path.StartsWith( $scriptsDir ) ) {
        mkdir -Path $scriptsDir -ErrorAction 'SilentlyContinue';
    }
    $encoding = switch( [System.IO.Path]::GetExtension( $path ) ) {
        { $_ -in '.ps1', '.xml' } { [System.Text.Encoding]::UTF8; }
        { $_ -in '.reg', '.vbs', '.js' } { [System.Text.UnicodeEncoding]::new( $false, $true ); }
        default { [System.Text.Encoding]::Default; }
    };
    [System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $file.InnerText.Trim() ) ) );
}
		</ExtractScript>
		<File path="%TEMP%\VBoxGuestAdditions.ps1">
&amp; {
	foreach( $letter in 'DEFGHIJKLMNOPQRSTUVWXYZ'.ToCharArray() ) {
		$exe = "${letter}:\VBoxWindowsAdditions.exe";
		if( Test-Path -LiteralPath $exe ) {
			$certs = "${letter}:\cert";
			&amp; "$certs\VBoxCertUtil.exe" add-trusted-publisher "$certs\vbox*.cer" --root "$certs\vbox*.cer";
			Start-Process -FilePath $exe -ArgumentList "/with_wddm", "/S" -Wait;
			return;
		}
	}
	'VBoxGuestAdditions.iso is not attached to this VM.';
} *&gt;&amp;1 &gt;&gt; "$env:TEMP\VBoxGuestAdditions.log";
		</File>
	</Extensions>
</unattend>

the same thing in 118 line (ntlite.com generator)

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
	<settings pass="oobeSystem">
		<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>040c:0000040c</InputLocale>
			<SystemLocale>fr-FR</SystemLocale>
			<UILanguage>fr-FR</UILanguage>
			<UILanguageFallback>fr-FR</UILanguageFallback>
			<UserLocale>fr-FR</UserLocale>
		</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">
			<TimeZone>Romance Standard Time</TimeZone>
			<OOBE>
				<HideEULAPage>true</HideEULAPage>
				<HideLocalAccountScreen>true</HideLocalAccountScreen>
				<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
				<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
				<NetworkLocation>Home</NetworkLocation>
				<ProtectYourPC>3</ProtectYourPC>
				<SkipMachineOOBE>true</SkipMachineOOBE>
				<SkipUserOOBE>true</SkipUserOOBE>
			</OOBE>
			<UserAccounts>
				<LocalAccounts>
					<LocalAccount wcm:action="add">
						<DisplayName>Admin</DisplayName>
						<Group>Administrators</Group>
						<Name>Admin</Name>
						<Password>
							<PlainText>true</PlainText>
							<Value></Value>
						</Password>
					</LocalAccount>
				</LocalAccounts>
			</UserAccounts>
		</component>
	</settings>
	<settings pass="specialize">
		<component name="Microsoft-Windows-Security-SPP-UX" 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">
			<SkipAutoActivation>true</SkipAutoActivation>
		</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">
			<ComputerName>Windows-10</ComputerName>
			<CopyProfile>true</CopyProfile>
		</component>
		<component name="Microsoft-Windows-UnattendedJoin" 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">
			<Identification>
				<JoinWorkgroup>WORKGROUP</JoinWorkgroup>
			</Identification>
		</component>
	</settings>
	<settings pass="windowsPE">
		<component name="Microsoft-Windows-International-Core-WinPE" 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>040c:0000040c</InputLocale>
			<SystemLocale>fr-FR</SystemLocale>
			<UILanguage>fr-FR</UILanguage>
			<UILanguageFallback>fr-FR</UILanguageFallback>
			<UserLocale>fr-FR</UserLocale>
			<SetupUILanguage>
				<UILanguage>fr-FR</UILanguage>
			</SetupUILanguage>
		</component>
		<component name="Microsoft-Windows-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">
			<Diagnostics>
				<OptIn>false</OptIn>
			</Diagnostics>
			<DiskConfiguration>
				<WillShowUI>OnError</WillShowUI>
				<Disk wcm:action="add">
					<DiskID>0</DiskID>
					<WillWipeDisk>true</WillWipeDisk>
					<CreatePartitions>
						<CreatePartition wcm:action="add">
							<Extend>true</Extend>
							<Order>1</Order>
							<Type>Primary</Type>
						</CreatePartition>
					</CreatePartitions>
					<ModifyPartitions>
						<ModifyPartition wcm:action="add">
							<Active>true</Active>
							<Format>NTFS</Format>
							<Letter>C</Letter>
							<Order>1</Order>
							<PartitionID>1</PartitionID>
						</ModifyPartition>
					</ModifyPartitions>
				</Disk>
			</DiskConfiguration>
			<DynamicUpdate>
				<Enable>false</Enable>
				<WillShowUI>OnError</WillShowUI>
			</DynamicUpdate>
			<ImageInstall>
				<OSImage>
					<Compact>true</Compact>
					<WillShowUI>OnError</WillShowUI>
					<InstallFrom>
						<MetaData wcm:action="add">
							<Key>/IMAGE/NAME</Key>
							<Value>Windows 10 Pro</Value>
						</MetaData>
					</InstallFrom>
					<InstallTo>
						<DiskID>0</DiskID>
						<PartitionID>1</PartitionID>
					</InstallTo>
				</OSImage>
			</ImageInstall>
			<UserData>
				<AcceptEula>true</AcceptEula>
				<ProductKey>
					<Key></Key>
				</ProductKey>
			</UserData>
		</component>
	</settings>
</unattend>

there is no need for more

the rest is configured in

sources$OEM$$$\Setup\Scripts\SetupComplete.cmd

if have add other files here

sources$OEM$$$\Setup\Files

example add a registry key +firefox install + windows 10 pro activation by kms server

file sources$OEM$$$\Setup\Scripts\SetupComplete.cmd

@echo off
"%WINDIR%\Setup\Files\FirefoxSetup.exe" /S /PreventRebootRequired=true
cscript C:\Windows\System32\slmgr.vbs /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
cscript C:\Windows\System32\slmgr.vbs /skms kms9.msguides.com
cscript C:\Windows\System32\slmgr.vbs /ato
regedit /S"%WINDIR%\Setup\Files\registerykey.reg"
rd /q /s "%WINDIR%\Setup\Files"
del /q /f "%0"

by generating the files this way it also makes them compatible with old windows

because this configuration is identical in all other versions since windows vista

which means that generating this way is compatible from Windows vista to Windows 11

the only line that changes is the following (and the serial number must always be empty)


<InstallFrom>
	<MetaData wcm:action="add">
		<Key>/IMAGE/NAME</Key>
		<Value>Windows 10 Pro</Value>
	</MetaData>
</InstallFrom>

Plain text off?

Can we set password plain text to off under Microsoft-Windows-Shell-Setup\UserAccounts section?
I need to enable the built-in Administrator account, and I have to copy and past the encrypted password from Windows System Image Manager every time I generated a new xml from the website.

Add Classic Context Menu option

I really hate the new one in Windows 11, do you think it's possible for you to add this...? I know it's possible through the registry editor during post-installation.

(I don't even know if you wanted people to post requests here...)

Enabling VirtIO installation is broken

The generator currently outputs the following XML when enabling virtio installation:

<RunSynchronousCommand wcm:action="add">
  <Order>24</Order>
  <Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath '%TEMP%\VirtIoGuestTools.ps1' -Raw | Invoke-Expression;"</Path>

<File path="%TEMP%\VirtIoGuestTools.ps1">
  <!-- etc. -->
</File>

On Windows startup a cmd.exe window pops open and asks for an Option "Path" (or similar, this is from the top of my head). The script itself is not run. I believe this is due to a problem with the extraction script, which doesn't properly handle the %TEMP% expansion. Manually rewriting the path to C:\Windows\Setup\Scripts\VirtIoGuestTools.ps1 fixes the problem.

Thanks for this great project!

ultimate performance power plan and hibernation

Hi, I'm not sure it's possible but I'm wondering if it was possible to add to disable windows hibernation, and enable the ultimate performance power plan by default (also set it as default if possible)

Disable core isolation

if you have virtualization enabled on the bios core isolation is enabled as a windows defender option, even if by a little it impacts in game performance, I would like an option to disable it if possible

[FutureIssues] 24H2 based LTSC Issues

This may be LTSC specific, I have yet to try it on full blown 24H2 as its not out yet, while LTSC is partially out.

Bloatware did not get removed and Recovery partition remains despite all being checked and using the remove option.

Haven't had a moment to check the rest, just redid the image twice to make sure.

Let me know if you need anything from me.

Problem with Administrator and user

Spectacular tool. Works great, although I'm finding a little problem. I'm trying to create a file that sets up 2 users account. One administrator and one normal user. Once the installation of windows is finished, it always creates only a single user without permissions. I also tried to create an autounattend file that sets a single user as administrator, but in the end it creates one with the right name, but it's local and without permissions.

Save states / load file to edit (feature request)

I want to edit previously created autounattend.xml on this website.
So I think it can be done when you (1) load it from file or (2) choose saved on site or (3) paste special code that is serialized data of forms (I think it's easiest way to make it possible) (like factorio blueprints codes)

Any idea about to set EFI and WinRE partitions size keeping interacitivity to select the main partition ?

Hi,

Let’s say I have something like this.

select-partition-install-clean-windows-10

Then, I manually delete partitions 1, 2, 3, 4 so I end up with 2 partitions. I would want to select the first one then the setup will automatically recreate all system partitions with the given size :

  • EFI : 499 Mo
  • WinRe : 1000 Mo
  • Windows : the available space.

This would avoid deleting another data partition.

Any idea if it would be possible ?

Remove bloatware didnt work after update

Used your generator a week ago. And the file structure was different. On the old version, Remove bloatware cleaned the system perfectly. Now I created a new file and some things are still there, like powershell ise. Also, when installing with a new file, some windows are completed with errors, but what exactly I do not have time to capture

Windows.old folder issue

Somehow after new installation by using the xml file generated by the website, there is an empty Windows.old folder under C partition.
Also, I put a registry key entry under "Scripts to run whenever a user logs on for the first time" section, but it seems not working for new (network) users' first login.

appreciation post

I solved the problem I had (it was my mistake) but I wanted to thank you for the fantastic tool you created :)

Invalid Specialize Pass When Using Custom Scripts

First of all, thanks for this awesome resource! It's been very useful! :)

I'm testing out the new addition of the Custom Script options. However, as soon as I add in one or more scripts, it breaks the answer file. The initial setup phases complete, but then it errors out complaining about an invalid specialize pass. Here's a screenshot:

image

I've now tested this one without any scripts, and the answer file still works fine as usual. However in testing once in a Windows 11 23H2 with 2 script sections (both powershell), and then with Windows 10 22H2 with a single powershell script section it fails with the above error. I'm including a URL to that most recent answer file.

URL: autounattend.xml

I had to look up what was going on with the <nul set /p= section of the redirection. I see it's useful to prevent newlines and the <nul prevents it from asking for input. However, I wonder if it's then setting the errorlevel to 1 as in these answers and that is causing the setup to think there is an error? (Totally not my area of knowledge, so I could be way out in left field...)

Anyway, hopefully we can find a fix for this. Thanks in advance! :)

Execution of .bat File

Would it be possible to add the option to execute a .bat or .cmd file as an administrator that is already previously saved in a folder?

The idea is for this .bat file to run only once during the system installation.

Thank you, I await your response ^^

Activating Eea option outside europe

I don't know if it's possible but I saw that the possibility to change the home location was added, I wanted to know if in general there was a possibility to somehow activate the options that are there when you install windows with a europe iso (uninstall edge or disable bing search) with an american iso, because it seems that if you change the ids to make it look like for example you are in Germany it makes you uninstall edge, I don't know if in general it's feasible with an unattend file but I wanted to ask

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.