Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Пользователь


Сообщения: 116
Благодарности: 12

Профиль | Отправить PM | Цитировать


Мой вариант:

Код: Выделить весь код
Option Explicit
Dim answer, answer2, answer3, answer4, answer5, answer6, computerName, domainAdminPass, domainName, domainAdminUsername, RegisteredOrganization, OU, unattendFile, WshShell, fso, unattendFileObject, strContents

unattendFile = "C:\Windows\Panther\unattend.xml"

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

Do While answer <> vbYes
   computerName = InputBox("Введите имя компьютера :", "Computer Name")
   answer = MsgBox("correct?" & vbCrLf & "Computer Name: " & computerName, vbYesNo, "Name")
Loop

Do While answer6 <> vbYes
   OU = InputBox("Введите различающееся имя нужного подразделения(OU=MyOU,DC=Domain,DC=com) :", "Подразделение")
   answer6 = MsgBox("correct?" & vbCrLf & "различающееся имя нужного подразделения(OU=MyOU,DC=Domain,DC=com): " & OU, vbYesNo, "OU")
Loop

Do While answer4 <> vbYes
   domainName = InputBox("Введите имя домена :", "Domain")
   answer4 = MsgBox("correct?" & vbCrLf & "Domaine : " & domainName, vbYesNo, "Domain")
Loop

Do While answer3 <> vbYes
   domainAdminUsername = InputBox("Пользоваель to join domain :", "User Name")
   answer3 = MsgBox("correct?" & vbCrLf & "user : " & domainAdminUsername, vbYesNo, "username")
Loop

Do While answer2 <> vbYes
   domainAdminPass = InputBox("Пароль to join domain :", "Domain Admin Password")
   answer2 = MsgBox("correct?" & vbCrLf & "Domain Admin Password: " & domainAdminPass, vbYesNo, "Password")
Loop

Do While answer5 <> vbYes
   RegisteredOrganization = InputBox("Организация :", "Название организации")
   answer5 = MsgBox("correct?" & vbCrLf & "Название организации: " & RegisteredOrganization, vbYesNo, "RegisteredOrganization")
Loop

WshShell.Run "%SYSTEMDRIVE%\sources\setup.exe /noreboot", 0, true

If fso.FileExists(unattendFile) = False Then
   wscript.echo "Не удается найти файл автоматической установки"
Else
   'Чтение файла автоматической установки и замена соответствующих переменных
   Set unattendFileObject = fso.OpenTextFile(unattendFile, 1)
   strContents = unattendFileObject.ReadAll
   strContents = Replace(strContents, "ReplaceMe1", computerName)
   strContents = Replace(strContents, "ReplaceMe6", OU)
   strContents = Replace(strContents, "ReplaceMe2", domainAdminPass)
   strContents = Replace(strContents, "ReplaceMe3", domainAdminUsername & "@" & domainName)
   strContents = Replace(strContents, "ReplaceMe4", domainName)
   strContents = Replace(strContents, "ReplaceMe5", RegisteredOrganization)
   unattendFileObject.Close

   'Запись обновленного содержимого в файл автоматической установки 
   Set unattendFileObject = fso.OpenTextFile(unattendFile, 2)
   unattendFileObject.Write(strContents)
   unattendFileObject.Close
End If

' Launch setup (will use the modified unattend.xml)
'WScript.Sleep 5000
'WshShell.Run "%WINDIR%\System32\oobe\windeploy.exe", 0, True
AUTOUNATTEND.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>ru-RU</UILanguage>
            </SetupUILanguage>
            <InputLocale>en-US; ru-RU</InputLocale>
            <SystemLocale>ru-RU</SystemLocale>
            <UILanguage>ru-RU</UILanguage>
            <UserLocale>uk-UA</UserLocale>
            <UILanguageFallback>ru-RU</UILanguageFallback>
        </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">
            <ImageInstall>
                <OSImage>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/INDEX</Key>
                            <Value>1</Value>
                        </MetaData>
                    </InstallFrom>
                    <WillShowUI>OnError</WillShowUI>
                </OSImage>
            </ImageInstall>
            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName>User</FullName>
                <Organization>ReplaceMe5</Organization>
            </UserData>
        </component>
    </settings>
    <settings pass="specialize">
        <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>ReplaceMe1</ComputerName>
            <RegisteredOrganization>ReplaceMe5</RegisteredOrganization>
            <TimeZone>FLE Standard Time</TimeZone>
        </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>
                <Credentials>
                    <Domain>ReplaceMe4</Domain>
                    <Password>ReplaceMe2</Password>
                    <Username>ReplaceMe3</Username>
                </Credentials>
                <JoinDomain>ReplaceMe4</JoinDomain>
                <DebugJoin>true</DebugJoin>
                <MachineObjectOU>ReplaceMe6</MachineObjectOU>
            </Identification>
        </component>
    </settings>
    <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; ru-RU</InputLocale>
            <SystemLocale>ru-RU</SystemLocale>
            <UILanguage>ru-RU</UILanguage>
            <UserLocale>ru-RU</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">
            <TimeZone>FLE Standard Time</TimeZone>
            <OEMInformation>
                <SupportPhone></SupportPhone>
                <Manufacturer>Sattva</Manufacturer>
                <Model>Unattended Windows 8 </Model>
                <SupportURL></SupportURL>
            </OEMInformation>
            <OOBE>
                <NetworkLocation>Work</NetworkLocation>
                <HideEULAPage>true</HideEULAPage>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <ProtectYourPC>1</ProtectYourPC>
                <SkipMachineOOBE>true</SkipMachineOOBE>
            </OOBE>
            <WindowsFeatures>
                <ShowInternetExplorer>true</ShowInternetExplorer>
                <ShowWindowsMediaPlayer>true</ShowWindowsMediaPlayer>
            </WindowsFeatures>
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>YQBkAG0AaQBuADEANAAwADMAMQA5ADgANgBQAGEAcwBzAHcAbwByAGQA</Value>
                            <PlainText>false</PlainText>
                        </Password>
                        <Name>Администратор</Name>
                        <Group>Administrators</Group>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <AutoLogon>
                <Password>
                    <Value>YQBkAG0AaQBuADEANAAwADMAMQA5ADgANgBQAGEAcwBzAHcAbwByAGQA</Value>
                    <PlainText>false</PlainText>
                </Password>
                <Enabled>true</Enabled>
                <LogonCount>2</LogonCount>
                <Domain></Domain>
                <Username>Администратор</Username>
            </AutoLogon>
            <RegisteredOrganization></RegisteredOrganization>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="wim:f:/unattended/windows_8/multiboot_usb_8gb-16gb_flash_v7.0/sources/install.wim#Windows 8 Enterprise (64-bit)" xmlns:cpi="urn:schemas-microsoft-com:cpi"></cpi:offlineImage>
</unattend>

Последний раз редактировалось sattva, 25-08-2013 в 15:52.

Это сообщение посчитали полезным следующие участники:

Отправлено: 01:44, 25-08-2013 | #4