autounattend.xml 파일 내 설치 미디어에서 스크립트를 실행하는 방법은 무엇입니까?

autounattend.xml 파일 내 설치 미디어에서 스크립트를 실행하는 방법은 무엇입니까?

자동화된 Windows 설치의 일부로 만들고 싶은 몇 가지 PowerShell(.ps1) 및 Batch(.bat) 스크립트를 만들었습니다. Windows 시스템 이미지 관리자를 사용하여 autounattend.xml 파일 내의 다른 모든 항목을 이미 구성했으며 스크립트 실행을 제외하고는 완벽하게 작동합니다.

완전히 자동화되기 전에는 OOBE를 우회하고 감사 모드(CTRL+SHIFT+F3)로 들어간 다음 거기에서 스크립트를 실행했습니다. 내 스크립트가 감사 모드에서 작동한다는 것을 알고 Windows 시스템 이미지 관리자 내에서 Pass 6 audituser에 동기 명령을 삽입하기로 결정했습니다.

이것은 지금까지 내 autouattend.xml 파일입니다.

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <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>cABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
                    <PlainText>false</PlainText>
                </Password>
                <Enabled>true</Enabled>
                <LogonCount>3</LogonCount>
                <Username>LocalAdmin</Username>
            </AutoLogon>
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>cABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
                            <PlainText>false</PlainText>
                        </Password>
                        <Name>LocalAdmin</Name>
                        <Group>Administrators</Group>
                        <DisplayName></DisplayName>
                        <Description>Local adminstrator stored on the system drive</Description>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <OOBE>
                <SkipMachineOOBE>true</SkipMachineOOBE>
                <SkipUserOOBE>true</SkipUserOOBE>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideEULAPage>true</HideEULAPage>
            </OOBE>
        </component>
    </settings>
    <settings pass="windowsPE">
        <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">
            <EnableNetwork>false</EnableNetwork>
            <DiskConfiguration>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Size>500</Size>
                            <Type>Primary</Type>
                        </CreatePartition>
                        <CreatePartition wcm:action="add">
                            <Order>2</Order>
                            <Type>EFI</Type>
                            <Size>100</Size>
                        </CreatePartition>
                        <CreatePartition wcm:action="add">
                            <Order>4</Order>
                            <Extend>true</Extend>
                            <Type>Primary</Type>
                        </CreatePartition>
                        <CreatePartition wcm:action="add">
                            <Order>3</Order>
                            <Size>16</Size>
                            <Type>MSR</Type>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Format>NTFS</Format>
                            <Label></Label>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                            <TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>
                        </ModifyPartition>
                        <ModifyPartition wcm:action="add">
                            <Order>2</Order>
                            <Format>FAT32</Format>
                            <PartitionID>2</PartitionID>
                            <Label>System</Label>
                        </ModifyPartition>
                        <ModifyPartition wcm:action="add">
                            <PartitionID>3</PartitionID>
                            <Order>3</Order>
                        </ModifyPartition>
                        <ModifyPartition wcm:action="add">
                            <PartitionID>4</PartitionID>
                            <Order>4</Order>
                            <Format>NTFS</Format>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <WillWipeDisk>true</WillWipeDisk>
                    <DiskID>0</DiskID>
                </Disk>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>4</PartitionID>
                    </InstallTo>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/NAME</Key>
                            <Value>Windows 10 Pro</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>
            <UserData>
                <ProductKey>
                    <WillShowUI>OnError</WillShowUI>
                    <Key />
                </ProductKey>
                <AcceptEula>true</AcceptEula>
            </UserData>
        </component>
        <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-gb</UILanguage>
            </SetupUILanguage>
            <InputLocale>en-gb</InputLocale>
            <SystemLocale>en-gb</SystemLocale>
            <UILanguageFallback>en-us</UILanguageFallback>
            <UILanguage>en-gb</UILanguage>
        </component>
    </settings>
    <settings pass="auditUser">
        <component name="Microsoft-Windows-Deployment" 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">
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Path>powershell.exe -executionpolicy remotesigned -File &quot;Files\Scripts\2A-Create_Daily_System_Restore_Point.ps1&quot;</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Description>Remove Windows Bloatware Provisioned Apps</Description>
                    <Order>1</Order>
                    <Path>powershell.exe -executionpolicy remotesigned -File &quot;%~dp0\Files\Scripts\1-Remove_Bloatware_Apps.ps1&quot;</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>3</Order>
                    <Path>cmd.exe /c %~dp0\Files\Scripts\3-Remove_Folders_from_This_PC.bat</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="wim:d:/users/will/documents/it%20projects/windows%2010%20image/install.wim#Windows 10 Home" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

Windows 설치 미디어의 루트에 'Scripts'라는 디렉터리를 배치할 예정이므로 설치 미디어의 autounattend.xml에서 이러한 스크립트를 어떻게 호출합니까? 설치미디어가 있는 드라이브와 경로를 연결해주는 변수가 있나요?

답변1

해결책을 찾은 것 같아요.

  1. ISO/Windows 설치 미디어를 폴더에 추출합니다.
  2. sources\추출된 설치 미디어의 디렉터리 내부에 다음과 같은 폴더를 만듭니다 .$OEM$
  3. 다음 경로의 디렉터리를 갖도록 시스템 드라이브를 미러링합니다.sources\$OEM$\$$\Setup\Scripts (C:\Windows\설정\스크립트)

$OEM$ 폴더는 시스템 드라이브를 미러링하므로 이 폴더 내의 모든 내용은 설치 중에 복사됩니다. autounattend.xml 파일에서 실행되는 스크립트와 관련하여 간단히 다음에서 스크립트를 호출하면 됩니다.%SystemDrive%\WinDir\Setup\Scripts

자세한 내용은 여기에서 확인하실 수 있습니다 >https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh825027%28v%3dwin.10%29

답변2

Afaik, auditUser시스템이 감사 모드로 전환되지 않으면 Windows 설치 중에 패스가 실행되지 않습니다. 따라서 귀하의 솔루션 외에 두 가지 가능한 솔루션이 있습니다.

  1. specialize패스 또는 패스 에 명령을 넣으십시오 oobeSystem. 일반적으로 설치 미디어에는 letter 가 할당되지만 X:설정에서 스크립트를 찾을 수 있도록 하려면 다음과 같은 조건을 사용할 수 있습니다.
                <RunSynchronousCommand wcm:action="add">
                    <Description>Run script</Description>
                    <Order>1</Order>
                    <!-- Enumerate through all drives looking for the MYIT_OEMBypass.ps1 script, if found, run it. Leave the command prompt open. -->
                    <Path>cmd /c "(FOR %i IN (C D E F G H I J K L N M) DO IF EXIST %i:\MYIT_OEMBypass.ps1 Powershell -executionpolicy ByPass %i:\MYIT_OEMBypass.ps1) & pause"</Path>
                </RunSynchronousCommand>
  1. oobeSystem다음을 입력하여 패스가 실행되기 시작할 때 Windows 설치 프로그램이 감사 모드(sysprep)로 바로 실행되도록 지시합니다 .
        <component name="Microsoft-Windows-Deployment" 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">
            <Reseal>
                <Mode>Audit</Mode>
                <ForceShutdownNow>false</ForceShutdownNow>
            </Reseal>
        </component>

이 방법을 사용하면유지할 수 있다통과 시 명령 auditUser. 이는 또한 즐겨찾는 모든 조정 사항이 포함된 기본 프로필을 설정하는 데 도움이 되므로 나중에 생성된 프로필에도 해당 모든 조정 사항이 적용됩니다.

그러나 기본적으로자동unattend.xml은 복사되어 sysprep의 unattend.xml 스크립트로 설정되며 이는 분명히 문제를 일으킬 수 있습니다. 따라서 sysprep이다른unattend.xml. 이 방법에 대한 자세한 지침은 여기에서 확인할 수 있습니다. https://rzander.azurewebsites.net/modern-os-deployment-mosd/

관련 정보