Windows 10 만능윈도우 만들기 -4-

이제 스크립트를 본격적으로 만들어 볼건데요. 어려울건 없습니다. 모르면 먼저 따라 해보고 하나씩 바꿔가 보면서 자기것으로 만들면 됩니다. 

 

먼저 unattend.xml 파일을 만들어 볼겁니다. 이건 이미 만들어져 있는것을 가지고 수정하는게 편합니다. 제대로 만들려면 adk 까지 인스톨 하고 만들어야 합니다. 이 파일을 생성해주는 홈페이지도 본듯 합니다. 중요한건 실전이지요. 

 

unattend.xml 파일은 sysprep으로 봉인된 이미지의 Windows > Panther 폴더에 넣어져야 작동을 합니다. 봉인이 안된 이미지에서는 무쓸모입니다. 

 

이미지 배포하시는분들이 만든 iso를 열어보면 AutoUnattend.xml 파일이 있을겁니다. ISO 이미지 루트에 있으며, unattend와 동일한 역활을 하게 됩니다. 아래 코드는 Unattend.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>ko-KR</UILanguage>
            </SetupUILanguage>
            <UILanguage>ko-KR</UILanguage>
            <LayeredDriver>5</LayeredDriver>
        </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">
            <UserData>
                <AcceptEula>true</AcceptEula>
            </UserData>
        </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">
       	<!-- User 계정으로 자동 로그인 -->
            <AutoLogon>
                <Enabled>true</Enabled>
                <LogonCount>1</LogonCount>
                <Username>user</Username>
            </AutoLogon>
            <!-- User 계정 생성 -->
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value></Value>
                            <PlainText>true</PlainText>
                        </Password>
                        <Description>Default Account</Description>
                        <DisplayName>user</DisplayName>
                        <Group>Administrators</Group>
                        <Name>user</Name>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <!-- 계정 생성 창 건너뜀 -->
            <OOBE>
                <SkipMachineOOBE>true</SkipMachineOOBE>
            </OOBE>
            <!-- 최초 로그인시 배치파일 실행 -->
            <FirstLogonCommands>
              <SynchronousCommand wcm:action="add">
                <Order>1</Order>
                <Description>SetupComplete</Description>
                <CommandLine>%windir%\Panther\SetupComplete.cmd > nul</CommandLine>
              </SynchronousCommand>
            </FirstLogonCommands>
        </component>
    </settings>

    <settings pass="specialize">
    	<!-- 이지드라이버 이미지 배포시 실행 -->
        <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>1</Order>
                    <Description>EasyDrv7</Description>
                    <Path>c:\users\public\EasyDrv7\EasyDrv7(Win10.x64).exe /a /c /r</Path>
                </RunSynchronousCommand>
             </RunSynchronous>
        </component>
		
        <!-- PC 소유자 이름 및 회사 설정 -->
        <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>user-pc</ComputerName>
              <RegisteredOwner>soo</RegisteredOwner>
              <RegisteredOrganization>soohyunet</RegisteredOrganization>
        </component>
        
		<!-- 작업그룹 설정 -->
        <component name="Microsoft-Windows-UnattendedJoin" 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">
            <Identification>
                <JoinWorkgroup>soohyunet</JoinWorkgroup>
            </Identification>
        </component>
</settings>

<cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

위에 자세히 주석을 단다고 달았는데 쉽게 이해가 될련지 모르겠습니다. 주석처리를 해서 실행은 안됩니다. x64(64비트)용입니다.  amd64 가 x64하고 동일한 뜻입니다. 

 

다음은 최초 로그인시에 실행되는 배치파일인 setupcomplete.cmd 파일입니다. 이것은 해당 이미지의 windows > setup > scripts > setupcomplete.cmd 파일이 작동을 하게되는데요. 전 좀 바꿔봤습니다. setupcomplete.cmd 파일은 원래위치에서 실행하게 해도 되며, 이 배치 파일의 이름은 다름이름으로 해도 무방합니다. 어짜피 위에 스크립트의 위치는 다르니까요. 저는 이 파일에서 윈도우즈 및 오피스 시리얼을 명령어로 입력합니다. 또한 전원 관련 설정을 넣어주고, 레지스트리를 병합 합니다.  이것을 setup 폴더에 안넣은 이유도 레지스트리 때문입니다. user 계정이 생성된 이후에 레지를 먹여야 하는 부분이 있어서 입니다. 이렇게 안할려면 default user.dat 파일을 편집하면 되지만, 이건 또 순정을 건드리는거라 이게 젤 편하더군요. 공부하다 보면 여러가지 방법이 있습니다. 다음은 예제입니다.  setupcomplete.cmd 이런식으로 저장하면 됩니다. 

@echo off
pushd %~dp0

::개인화 설정 레지스트리
%windir%\system32\regedt32.exe /s Prefetch.reg

::윈도우 오피스 시리얼 입력 
cscript //Nologo %windir%\system32\slmgr.vbs /ipk 윈도우 시리얼
cscript //Nologo "c:\Program Files\Microsoft Office\Office15\ospp.vbs" /inpkey:오피스시리얼
::오피스 2016, 2019는 아래 스크립트로 
::cscript //Nologo "c:\Program Files\Microsoft Office\Office16\ospp.vbs" /inpkey:오피스시리얼

::user 계정 비번 기한 무제한 설정 
wmic path Win32_userAccount where Name='user' set PasswordExpires=false

::공유 관련 방화벽 룰 설정 
netsh advfirewall firewall set rule group="네트워크 검색" new enable=no
netsh advfirewall firewall set rule group="파일 및 프린터 공유" new enable=no

::전원 옵션 설정 변경 (최고의 성능 및 최대 절전 모드해제, 모니터 꺼짐 해제)
powercfg -s e9a42b02-d5df-448d-aa00-03f14749eb61
powercfg -change -monitor-timeout-ac 0
powercfg -h off

::찌꺼지 삭제 배치파일 호출
DeleteScript.cmd > nul

prefetch.reg 레지스트리 파일 공개 합니다. 좀 복잡할수도 있는데, 필요하신것들을 넣으시면됩니다. 어디까지나 예제이므로 편한데로 편집해서 쓰시면 됩니다.  맨 앞줄에 ; 는 주석이므로, 필요한 부분이 있으면 주석 삭제하고 사용하시면 됩니다. 꼭 필요한 부분만 써도 됩니다. 

Windows Registry Editor Version 5.00

;인터넷 아이콘등록

[-HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}]

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}]
@="Internet Explorer"
"InfoTip"="@C:\\Windows\\System32\\ieframe.dll,-881"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\DefaultIcon]
@="C:\\Windows\\System32\\ieframe.dll,-190"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\InProcServer32]
@="C:\\Windows\\System32\\ieframe.dll"
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell]
@="OpenHomePage"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell\NoAddOns]
@="Start Without Add-ons"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell\NoAddOns\Command]
@="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -extoff"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell\OpenHomePage]
@="Open &Home Page"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell\OpenHomePage\Command]
@="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\""

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell\Properties]
@="P&roperties"
"Position"="bottom"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\shell\Properties\command]
@="control.exe inetcpl.cpl"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\Shellex\ContextMenuHandlers\ieframe]
@="{871C5380-42A0-1069-A2EA-08002B30309D}"

[HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\Shellex\MayChangeDefaultMenu]
@=""

[-HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30301D}\ShellFolder]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{871C5380-42A0-1069-A2EA-08002B30301D}]

; 구글 크롬 플래쉬 허용 (모든 사이트)
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome]
"DefaultPluginsSetting"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\PluginsAllowedForUrls]
"1"="http://*"
"2"="https://*"

;사용자 계정 컨트롤 사용 안함 (UAC)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"ConsentPromptBehaviorAdmin"=dword:00000000
"EnableLUA"=dword:00000000
"PromptOnSecureDesktop"=dword:00000000

;익스플로러 11의 호환성 보기 추가입니다. (sen.go.kr, microsoft.com, g2b.go.kr, s2b.kr등)
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData]
"UserFilter"=hex:41,1f,00,00,53,08,ad,ba,05,00,00,00,ca,00,00,00,01,00,00,00,\
  05,00,00,00,0c,00,00,00,06,1c,f7,61,e3,7b,d4,01,01,00,00,00,09,00,73,00,65,\
  00,6e,00,2e,00,67,00,6f,00,2e,00,6b,00,72,00,0c,00,00,00,ad,10,13,67,e3,7b,\
  d4,01,01,00,00,00,0d,00,68,00,6f,00,6d,00,65,00,74,00,61,00,78,00,2e,00,67,\
  00,6f,00,2e,00,6b,00,72,00,0c,00,00,00,d4,7e,75,70,e3,7b,d4,01,01,00,00,00,\
  09,00,67,00,32,00,62,00,2e,00,67,00,6f,00,2e,00,6b,00,72,00,0c,00,00,00,4d,\
  62,81,72,e3,7b,d4,01,01,00,00,00,06,00,73,00,32,00,62,00,2e,00,6b,00,72,00,\
  0c,00,00,00,5c,4c,08,78,e3,7b,d4,01,01,00,00,00,0d,00,6d,00,69,00,63,00,72,\
  00,6f,00,73,00,6f,00,66,00,74,00,2e,00,63,00,6f,00,6d,00

 ;홈페이지 네이버 적용
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.naver.com/"

;탐색기 다크테마 적용
;[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize]
;"ColorPrevalence"=dword:00000000
;"EnableTransparency"=dword:00000001
;"AppsUseLightTheme"=dword:00000000

;인터넷 옵션 자동 구성 > Lan 설정 > 자동으로 설정검색 체크 해제
;hex 아홉번째 값이 01 이면 해제, 01, 05, 09, 0d 중에 하나로 결정
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]
"DefaultConnectionSettings"=hex:46,00,00,00,04,00,00,00,01,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"SavedLegacySettings"=hex:46,00,00,00,06,00,00,00,01,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00

;바탕화면 아이콘, 내피씨, 휴지통 두개 활성화
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
"{018D5C66-4533-4307-9B53-224DE2ED1FE6}"=dword:00000001
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000
"{645FF040-5081-101B-9F08-00AA002F954E}"=dword:00000000
"{59031a47-3f72-44a7-89c5-5595fe6b30ee}"=dword:00000001
"{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dword:00000001
"{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"=dword:00000001
"{871C5380-42A0-1069-A2EA-08002B30301D}"=dword:00000000

;알림센터 감추기
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer]
"DisableNotificationCenter"=dword:00000001

; 응용프로그램 알림을 비활성화
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications]
"ToastEnabled"=dword:00000000
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications]
"NoToastApplicationNotification"=dword:00000001

; Windows Installer- 높은 권한으로 항상 설치
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer]
"AlwaysInstallElevated"=dword:00000001

; 자동 실행 사용 안 함
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoDriveTypeAutoRun"=dword:000000ff

;부팅시 넘버락키 자동켜기
[HKEY_CURRENT_USER\Control Panel\Keyboard]
"InitialKeyboardIndicators"="2"

이제 setupcomplete.cmd 파일에서 마지막에 호출하는 deletescript.cmd 파일을 보겠습니다. 

@echo off
pushd %~dp0
timeout /t 5 /nobreak > nul
rmdir /s /q C:\Users\Public\EasyDrv7
rmdir /s /q C:\Users\Public\Kdriver
rmdir /s /q C:\Drivers
rmdir /s /q C:\Windows\KDriverLog
del /f /q C:\Windows\Panther\SetupComplete.cmd
del /f /q C:\Windows\Panther\Prefetch.reg
del /f /q C:\Windows\Panther\unattend.xml
del /f /q "C:\Windows\Panther\Internet Explorer.lnk"
del /f /q C:\Windows\Panther\LayoutModification.xml
rem 다음 재부팅시 거래처별 프로그램 설치 프로그램 실행 스케줄러 등록
schtasks /create /sc ONLOGON /tn "install" /tr "c:\users\public\doksan.exe" /F /RL HIGHEST
shutdown /r /f /t 20
::자기 자신파일 삭제
DEL /F /Q %0% > nul

흠.. 스크립트가 또 남았었네요. 

LayoutModification 이라는 스크립트인데요. 이건 작업표시줄 변경하는 xml 파일입니다. 

이거 설명하려면 너무 길어져서 예제만 보여드리고, 따로 포스팅을 한번 하겠습니다. 

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection>
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%allusersprofile%\Microsoft\Windows\Start Menu\Programs\Accessories\Internet Explorer.lnk" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%allusersprofile%\Microsoft\Windows\Start Menu\Programs\Accessories\Snipping Tool.lnk" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%allusersprofile%\Microsoft\Windows\Start Menu\Programs\Chrome.lnk" />
        <taskbar:UWA AppUserModelID="Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App" />
        <taskbar:UWA AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
 </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

위 스크립트 들을 조합하면 설치 후 작업도 프로그램 설치 설정팡리 적용등 쉽게 하실 수 있습니다. 

 

중구난방된 설명이었지만 처음 해보는 분이 계시다면 쉽지 않은 일입니다. 저두 이걸 공부하기 위해서 부단한 노력을 했으니까요. 저처럼 일반인은 반복 경험 밖에 답이 없더군요. 천재가 되고 싶습니당... 

 

다음 포스팅은 여태 까지 내용 정리좀 하고 만능윈도우 만드는것은 마무리를 하겠습니다. 중간 중간 너무 길어질듯해서 예제만 나온 내용들은 너무 길어져서 포스팅을 따로 해서 올려 놓겠습니다. 

 

만능윈도우를 만드시는 분들께 도움이 되셨으면 합니다. 

이 글을 공유하기

댓글

Designed by JB FACTORY