Bonjour,
je souhaiterai ajouter des éléments sur un fichier XML existant via script, mais je ne sais pas comment m'y prendre, mes connaissances scripting étant limitées.

Le fichier à modifier est un unattend Windows. En fait, je souhaiterai ajouter l'intégration dans le domaine dans ce fichier, en fonction d'un choix que je gère.

Grosso modo, un extrait du fichier initial :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
<unattend ...>
<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>%SOINAME%</ComputerName>
            <RegisteredOrganization></RegisteredOrganization>
            <RegisteredOwner></RegisteredOwner>
            <ShowWindowsLive>false</ShowWindowsLive>
            <TimeZone>%SOITIMEZONE%</TimeZone>
        </component>
</unattend>
L'élément que je dois ajouter dans le SETTINGS specialize du fichier xml comporte la structure suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<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>TOTO</Domain>
                    <Password>zero</Password>
                    <Username>toto</Username>
                </Credentials>
                <JoinDomain>toto.ecole</JoinDomain>
            </Identification>
        </component>
Comment procéder ?

Merci de votre aide.