Hi,
2017-07-31 10:11
App removal section was remade with "familyname"
This powershell script (that you can run in a unattend windows installation) will clean up some unwanted apps
It can clear only the menu item ot the complete app and prevent futur installation from store
If you run it in unattend windows installation, you must include this command in autounattent.xml:
<SynchronousCommand wcm:action="add">
<Description>powershell permission remotesigned</Description>
<Order>1</Order>
<CommandLine>reg add HKCU\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ /v ExecutionPolicy /t Reg_SZ /d "RemoteSigned" /f</CommandLine>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
Note: it allow local powershell script executions. you should block it in domain GPO later, it is not secure to let it allowed (Expecially if the user have admin right on it's own computer)
#Set-ExecutionPolicy -scope localmachine remotesigned
### run as admin
#If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
#{
#$arguments = "& '" + $myinvocation.mycommand.definition + "'"
#Start-Process powershell -Verb runAs -ArgumentList $arguments
#Break
#}
### just list the items that are in the array, do not remove anything
$listonly01 = 0
### remove menu item only
write-host "=== will remove menu icon"
[string[]]$items01="SkypeApp_kzf8qxf38zg5c"
$items01+="OneNote_8wekyb3d8bbwe"
$items01+="MicrosoftEdge_8wekyb3d8bbwe"
$items01+="HolographicFirstRun_cw5n1h2txyewy"
$items01+="ContactSupport_cw5n1h2txyewy"
$items01+="3DBuilder_8wekyb3d8bbwe"
$items01+="Getstarted_8wekyb3d8bbwe"
$items01+="Photos_8wekyb3d8bbwe"
$items01+="WindowsCamera_8wekyb3d8bbwe"
$items01+="windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.calendar"
$items01+="windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.mail"
$items01+="BingWeather_8wekyb3d8bbwe"
$items01+="actualité"
$items01+="twitter"
$items01+="sketchbook"
$action01 = "*Détacher de l*écran d*accueil*"
foreach ($item01 in $items01)
{
if ($listonly01 -eq 1)
{
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | select name, path | where-object {$_.path –like "*$item01*" -or $_.name –like "*$item01*"})
}
else
{
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | where-object {$_.path –like "*$item01*"}).Verbs() | ?{$_.Name.replace('&','') -like "$action01"} | %{$_.DOIT()}
}
}
### remove menu item, app, lock future installation
write-host "=== will remove menu icon, delete app, prevent futur install"
[string[]]$items02="http://java.com/help"
$items02+="MicrosoftSolitaireCollection_8wekyb3d8bbwe"
$items02+="MSPaint_8wekyb3d8bbwe"
$items02+="Microsoft3DViewer_8wekyb3d8bbwe"
$items02+="XboxApp_8wekyb3d8bbwe"
$items02+="ZuneMusic_8wekyb3d8bbwe"
$items02+="ZuneVideo_8wekyb3d8bbwe"
$items02+="MicrosoftOfficeHub_8wekyb3d8bbwe"
$items02+="http://java.com/"
$items02+="asphalt*8*airborne"
$items02+="marchofempire"
$items02+="bubblewitch3saga"
$items02+="candycrushsodasaga"
$items02+="asphalt*8*airborne"
$items02+="minecraft"
$items02+="xbox"
$action01 = "*Détacher de l*écran d*accueil*"
foreach ($item02 in $items02)
{
if ($listonly01 -eq 1)
{
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | select name, path | where-object {$_.path –like "*$item02*" -or $_.name –like "*$item02*"})
}
else
{
write-host $action01 ":" $item02
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | where-object {$_.path –like "*$item02*"}).Verbs() | ?{$_.Name.replace('&','') -like "$action01"} | %{$_.doit()}
write-host "removing: " $item02
(Get-AppxPackage -allusers | where-object {$_.name –like "*$item02*" -or $_.PackageFamilyName –like "*$item02*"}) | Remove-AppxPackage
write-host "removing online install: " $item02
Get-appxprovisionedpackage –online | where-object {$_.name –like "*$item02*" -or $_.PackageFamilyName –like "*$item02*"} | remove-appxprovisionedpackage –online
}
}
Saturday, July 29, 2017
autounattend xml file generation with vbs wsh
Hi,
This script will:
read 2 of 3 files:
SynchronousCommand01_maison.txt
SynchronousCommand02_job.txt
SynchronousCommand03_common.txt
and generate a 64 bits autounattend.xml file in same folder as the script
If config01 is equal to 1, common and job files will be used to generate the autounattend.xml
If config01 is equal to 2, common and maison files will be used.
The 3 input files should look like this (3 lines for each synchronous command)
===== SynchronousCommand03_common.txt ======
1
powershell permission remotesigned
reg add HKCU\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ /v ExecutionPolicy /t Reg_SZ /d "RemoteSigned" /f
3
7zip
cmd /c c:\_appsall\7zip\commandline.bat
1
explorer open in this PC
REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v LaunchTo /t REG_DWORD /d 1 /f
====== end of file ======
You can change in the script (with notepad) the value config01 to inrtegrate "maison" (config01 = 1) or job (config01 = 2)
It is for 64 bits only, but you can change it for 32 bits (x86) in an array (it used to generate the file for both, but i had an issue where the synchronous commands were executed twice in 64 bits.
'=== autounattend.vbs
'=== autounattend.xml file generator for windows 10 1703
'=== by sergefournier@hotmail.com 2017-06-20
'=== save thsi script as: csv2xml.VBS
'=== input file must be sample1.csv in the same directory as the script (same folder)
'=== outputfile will be sampleout1.xml
'=== zzz_troubleshooting.txt will tell you what was not processed (lines)
'=== support 2 carriage return in a field, but not 3 :P
Set objFSO = CreateObject("Scripting.FileSystemObject")
'=== actual drive, actual directory, and "\"
thepath=WScript.ScriptFullName
p = instrRev(thepath,"\")
basedir = left(thepath,p)
filnam = right(thepath,len(thepath)-p)
logall = 1
if logall=1 then
'=== debug log
logfile01 = basedir & filnam & "_log.txt"
on error resume next
Set Fil02 = objFSo.OpenTextFile(logfile01, 2, true)
on error goto 0
end if
if logall=1 then
fil02.WriteLine date & " " & time & " START"
end if
filenamefullxml02 = basedir & "autounattend.xml"
'=== 1 = maison
'=== 2 = job
config01 = 2
'=== spaces in xml name are not good
quebec01 = 1
if quebec01 = 0 then
UILanguage01 = "en-US"
InputLocale01 = "0426:00010426"
SystemLocale01 = UILanguage01
UILanguage02 = UILanguage01
UILanguageFallback01 = UILanguage01
UserLocale01 = UILanguage01
else
'=== winpe and preload (france only)
UILanguage01 = "fr-FR"
InputLocale01 = "0c0c:00001009"
SystemLocale01 = UILanguage01
UILanguage02 = UILanguage01
UILanguageFallback01 = UILanguage01
UserLocale01 = "fr-CA"
'=== windows 10
UILanguage11 = "fr-CA"
InputLocale11 = "0c0c:00001009"
SystemLocale11 = UILanguage11
UILanguage12 = UILanguage11
UILanguageFallback11 = UILanguage11
UserLocale11 = UILanguage11
end if
'=== userdate
if config01 = 1 then
'=== home
fullname01 = "Maison"
else
fullname01 = "Utilisateur"
end if
username01 = fullname01
organization01 = ""
productkey01 = "W269N-WFGWX-YVC9B-4J6C9-T83GX"
enablefirewall01 = "true"
'1 Specifies the recommended level of protection for your computer.
'2 Specifies that only updates are installed.
'3 Specifies that automatic protection is disabled.
if config01 = 1 then
'=== home
NetworkLocation01 = "Home"
protectyourpc01 = "2"
else
NetworkLocation01 = "Work"
protectyourpc01 = "3"
end if
password01 = ""
'=== localaccount
description01 = "Utilisateuradmin"
displayname01 = fullname01
group01= "Administrators"
name01 = fullname01
RegisteredOrganization01 = ""
registredowner01 = ""
computername01 = ""
timezone01 = "Eastern Standard Time"
installfromtag01 = 1 '=== put install from to choose an image index in WIM
installtotag01 = 0 '=== put installto to choose disk 0 partition 0
archs01 = array("amd64") '=== architecture
'archs01 = array("x86", "amd64") '=== architecture
'=== create xml
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Set objIntro = xmlDoc.createProcessingInstruction("xml","version='1.0' encoding='UTF-8'")
xmlDoc.insertBefore objIntro,xmlDoc.childNodes(0)
Set objxmlchild01 = xmlDoc.createElement("unattend")
objxmlchild01.SetAttribute "xmlns", "urn:schemas-microsoft-com:unattend"
xmlDoc.appendChild objxmlchild01
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "windowsPE"
objxmlchild01.appendChild objxmlchild02
'=== Microsoft-Windows-International-Core-WINPE
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-International-Core-WinPE"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("SetupUILanguage")
objxmlchild03.appendChild objxmlchild04
'=== france setup cause canada does not exist in winpe
Set objxmlchild05 = xmlDoc.createElement("UILanguage")
objxmlchild05.text = UILanguage01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild04 = xmlDoc.createElement("InputLocale")
objxmlchild04.text = InputLocale01
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("SystemLocale")
objxmlchild04.text = SystemLocale01
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguage")
objxmlchild04.text = UILanguage02
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguageFallback")
objxmlchild04.text = UILanguageFallback01
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UserLocale")
objxmlchild04.text = UserLocale01
objxmlchild03.appendChild objxmlchild04
next
'===Microsoft-Windows-Setup
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Setup"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("ImageInstall")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("OSImage")
objxmlchild04.appendChild objxmlchild05
if installfromtag01 = 1 then
'=== choose image in index1 in dvd (wim index)
Set objxmlchild06 = xmlDoc.createElement("InstallFrom")
objxmlchild05.appendChild objxmlchild06
Set objxmlchild07 = xmlDoc.createElement("MetaData")
objxmlchild07.SetAttribute "wcm:action", "add"
objxmlchild06.appendChild objxmlchild07
Set objxmlchild08 = xmlDoc.createElement("Value")
objxmlchild08.text = "1"
objxmlchild07.appendChild objxmlchild08
Set objxmlchild08 = xmlDoc.createElement("key")
objxmlchild08.text = "/IMAGE/INDEX"
objxmlchild07.appendChild objxmlchild08
end if
'=== installto
if installtotag01 = 1 then
Set objxmlchild06 = xmlDoc.createElement("InstallTo")
objxmlchild05.appendChild objxmlchild06
Set objxmlchild07 = xmlDoc.createElement("DiskID")
objxmlchild07.text = "0"
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("PartitionID")
objxmlchild07.text = "1"
objxmlchild06.appendChild objxmlchild07
end if
Set objxmlchild06 = xmlDoc.createElement("InstallToAvailablePartition")
objxmlchild06.text = "false"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("WillShowUI")
objxmlchild06.text = "OnError"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild04 = xmlDoc.createElement("UserData")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("AcceptEula")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("FullName")
objxmlchild05.text = fullname01
objxmlchild04.appendChild objxmlchild05
if len(Organization01) > 0 then
Set objxmlchild05 = xmlDoc.createElement("Organization")
objxmlchild05.text = organization01
objxmlchild04.appendChild objxmlchild05
end if
Set objxmlchild05 = xmlDoc.createElement("ProductKey")
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Key")
objxmlchild06.text = productkey01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild04 = xmlDoc.createElement("EnableFirewall")
objxmlchild04.text = enablefirewall01
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-LUA-Settings
for each arch01 in archs01
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "offlineServicing"
objxmlchild01.appendChild objxmlchild02
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-LUA-Settings"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("EnableLUA")
objxmlchild04.text = "false"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-Security-SPP
for each arch01 in archs01
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "generalize"
objxmlchild01.appendChild objxmlchild02
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Security-SPP"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("SkipRearm")
objxmlchild04.text = "1"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-International-Core
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "specialize"
objxmlchild01.appendChild objxmlchild02
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-International-Core"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
'=== canada quebec setup language here
Set objxmlchild04 = xmlDoc.createElement("InputLocale")
objxmlchild04.text = InputLocale11
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("SystemLocale")
objxmlchild04.text = SystemLocale11
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguage")
objxmlchild04.text = UILanguage12
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguageFallback")
objxmlchild04.text = UILanguageFallback11
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UserLocale")
objxmlchild04.text = UserLocale11
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-Security-SPP-UX
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Security-SPP-UX"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("SkipAutoActivation")
objxmlchild04.text = "true"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-SQMApi
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-SQMApi"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("CEIPEnabled")
objxmlchild04.text = "0"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-Shell-Setup"
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Shell-Setup"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
if len(computername01)<>0 then
Set objxmlchild04 = xmlDoc.createElement("ComputerName")
objxmlchild04.text = computername01
objxmlchild03.appendChild objxmlchild04
end if
Set objxmlchild04 = xmlDoc.createElement("ProductKey")
objxmlchild04.text = productkey01
objxmlchild03.appendChild objxmlchild04
next
'=== oobeSystem
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "oobeSystem"
objxmlchild01.appendChild objxmlchild02
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Shell-Setup"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("AutoLogon")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("Password")
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Value")
objxmlchild06.text = password01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("PlainText")
objxmlchild06.text = "true"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild05 = xmlDoc.createElement("Enabled")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("Username")
objxmlchild05.text = username01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild04 = xmlDoc.createElement("OOBE")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("HideEULAPage")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("HideOEMRegistrationScreen")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("HideOnlineAccountScreens")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("HideWirelessSetupInOOBE")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("NetworkLocation")
objxmlchild05.text = NetworkLocation01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("SkipUserOOBE")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("SkipMachineOOBE")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("ProtectYourPC")
objxmlchild05.text = ProtectYourPC01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild04 = xmlDoc.createElement("UserAccounts")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("LocalAccounts")
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("LocalAccount")
objxmlchild06.SetAttribute "wcm:action", "add"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild07 = xmlDoc.createElement("Password")
objxmlchild07.text = password01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild08 = xmlDoc.createElement("Value")
objxmlchild08.text = password01
objxmlchild07.appendChild objxmlchild08
Set objxmlchild08 = xmlDoc.createElement("PlainText")
objxmlchild08.text = "true"
objxmlchild07.appendChild objxmlchild08
Set objxmlchild07 = xmlDoc.createElement("Description")
objxmlchild07.text = description01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("DisplayName")
objxmlchild07.text = displayname01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("Group")
objxmlchild07.text = group01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("Name")
objxmlchild07.text = name01
objxmlchild06.appendChild objxmlchild07
if len(RegisteredOrganization01)>0 then
Set objxmlchild04 = xmlDoc.createElement("RegisteredOrganization")
objxmlchild04.text = RegisteredOrganization01
objxmlchild03.appendChild objxmlchild04
end if
if len(RegistredOwner01)>0 then
Set objxmlchild04 = xmlDoc.createElement("RegisteredOwner")
objxmlchild04.text = RegistredOwner01
objxmlchild03.appendChild objxmlchild04
end if
Set objxmlchild04 = xmlDoc.createElement("DisableAutoDaylightTimeSet")
objxmlchild04.text = "false"
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("FirstLogonCommands")
objxmlchild03.appendChild objxmlchild04
d = firstlogoncommands(objxmlchild04)
Set objxmlchild04 = xmlDoc.createElement("TimeZone")
objxmlchild04.text = timezone01
objxmlchild03.appendChild objxmlchild04
next
'=== 64 bits
fil02.WriteLine date & " " & time & " Saving xml file: " & filenamefullxml02
xmlDoc.Save filenamefullxml02
fil02.WriteLine date & " " & time & " END"
fil02.close
'=======================================
function firstlogoncommands(objxmlchild04)
order01 = 0
filenamefull01 = basedir & "SynchronousCommand03_common.txt"
fil02.WriteLine date & " " & time & " common synchronous commands: " & filenamefull01
Set File01 = objFSo.OpenTextFile(filenamefull01, 1, true)
'=== read filed names (1st line)
totline01 = 0
Do While file01.AtEndOfStream <> True
err01 = 0: err02 = "": on error resume next
line01 = file01.readline
line02 = file01.readline
line03 = file01.readline
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
err01 = 0: err02 = "": on error resume next
line01 = line01 + 1 '=== check if it is a number
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
totline01 = totline01 + 3
Set objxmlchild05 = xmlDoc.createElement("SynchronousCommand")
objxmlchild05.SetAttribute "wcm:action", "add"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Description")
objxmlchild06.text = line02
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("Order")
order01 = order01 + 1
objxmlchild06.text = order01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("CommandLine")
objxmlchild06.text = line03
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("RequiresUserInput")
objxmlchild06.text = "false"
objxmlchild05.appendChild objxmlchild06
else
fil02.WriteLine date & " " & time & " ERROR data integrity, need 1 number, description, command: " & totline01
end if
else
fil02.WriteLine date & " " & time & " ERROR reading line at: " & totline01
end if
loop
file01.close
if config01 = 1 then
filenamefull02 = basedir & "SynchronousCommand01_maison.txt"
elseif config01 = 2 then
filenamefull02 = basedir & "SynchronousCommand02_job.txt"
end if
fil02.WriteLine date & " " & time & " maison or job synchronous commands: " & filenamefull02
Set File02 = objFSo.OpenTextFile(filenamefull02, 1, true)
'=== read filed names (1st line)
totline01 = 0
Do While file02.AtEndOfStream <> True
err01 = 0: err02 = "": on error resume next
line01 = file02.readline
line02 = file02.readline
line03 = file02.readline
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
err01 = 0: err02 = "": on error resume next
line01 = line01 + 1 '=== check if it is a number
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
totline01 = totline01 + 3
Set objxmlchild05 = xmlDoc.createElement("SynchronousCommand")
objxmlchild05.SetAttribute "wcm:action", "add"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Description")
objxmlchild06.text = line02
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("Order")
order01 = order01 + 1
objxmlchild06.text = order01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("CommandLine")
objxmlchild06.text = line03
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("RequiresUserInput")
objxmlchild06.text = "false"
objxmlchild05.appendChild objxmlchild06
else
fil02.WriteLine date & " " & time & " ERROR data integrity, need 1 number, description, command: " & totline01
end if
else
fil02.WriteLine date & " " & time & " ERROR reading line at: " & totline01
end if
loop
file02.close
end function
This script will:
read 2 of 3 files:
SynchronousCommand01_maison.txt
SynchronousCommand02_job.txt
SynchronousCommand03_common.txt
and generate a 64 bits autounattend.xml file in same folder as the script
If config01 is equal to 1, common and job files will be used to generate the autounattend.xml
If config01 is equal to 2, common and maison files will be used.
The 3 input files should look like this (3 lines for each synchronous command)
===== SynchronousCommand03_common.txt ======
1
powershell permission remotesigned
reg add HKCU\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ /v ExecutionPolicy /t Reg_SZ /d "RemoteSigned" /f
3
7zip
cmd /c c:\_appsall\7zip\commandline.bat
1
explorer open in this PC
REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v LaunchTo /t REG_DWORD /d 1 /f
====== end of file ======
You can change in the script (with notepad) the value config01 to inrtegrate "maison" (config01 = 1) or job (config01 = 2)
It is for 64 bits only, but you can change it for 32 bits (x86) in an array (it used to generate the file for both, but i had an issue where the synchronous commands were executed twice in 64 bits.
'=== autounattend.vbs
'=== autounattend.xml file generator for windows 10 1703
'=== by sergefournier@hotmail.com 2017-06-20
'=== save thsi script as: csv2xml.VBS
'=== input file must be sample1.csv in the same directory as the script (same folder)
'=== outputfile will be sampleout1.xml
'=== zzz_troubleshooting.txt will tell you what was not processed (lines)
'=== support 2 carriage return in a field, but not 3 :P
Set objFSO = CreateObject("Scripting.FileSystemObject")
'=== actual drive, actual directory, and "\"
thepath=WScript.ScriptFullName
p = instrRev(thepath,"\")
basedir = left(thepath,p)
filnam = right(thepath,len(thepath)-p)
logall = 1
if logall=1 then
'=== debug log
logfile01 = basedir & filnam & "_log.txt"
on error resume next
Set Fil02 = objFSo.OpenTextFile(logfile01, 2, true)
on error goto 0
end if
if logall=1 then
fil02.WriteLine date & " " & time & " START"
end if
filenamefullxml02 = basedir & "autounattend.xml"
'=== 1 = maison
'=== 2 = job
config01 = 2
'=== spaces in xml name are not good
quebec01 = 1
if quebec01 = 0 then
UILanguage01 = "en-US"
InputLocale01 = "0426:00010426"
SystemLocale01 = UILanguage01
UILanguage02 = UILanguage01
UILanguageFallback01 = UILanguage01
UserLocale01 = UILanguage01
else
'=== winpe and preload (france only)
UILanguage01 = "fr-FR"
InputLocale01 = "0c0c:00001009"
SystemLocale01 = UILanguage01
UILanguage02 = UILanguage01
UILanguageFallback01 = UILanguage01
UserLocale01 = "fr-CA"
'=== windows 10
UILanguage11 = "fr-CA"
InputLocale11 = "0c0c:00001009"
SystemLocale11 = UILanguage11
UILanguage12 = UILanguage11
UILanguageFallback11 = UILanguage11
UserLocale11 = UILanguage11
end if
'=== userdate
if config01 = 1 then
'=== home
fullname01 = "Maison"
else
fullname01 = "Utilisateur"
end if
username01 = fullname01
organization01 = ""
productkey01 = "W269N-WFGWX-YVC9B-4J6C9-T83GX"
enablefirewall01 = "true"
'1 Specifies the recommended level of protection for your computer.
'2 Specifies that only updates are installed.
'3 Specifies that automatic protection is disabled.
if config01 = 1 then
'=== home
NetworkLocation01 = "Home"
protectyourpc01 = "2"
else
NetworkLocation01 = "Work"
protectyourpc01 = "3"
end if
password01 = ""
'=== localaccount
description01 = "Utilisateuradmin"
displayname01 = fullname01
group01= "Administrators"
name01 = fullname01
RegisteredOrganization01 = ""
registredowner01 = ""
computername01 = ""
timezone01 = "Eastern Standard Time"
installfromtag01 = 1 '=== put install from to choose an image index in WIM
installtotag01 = 0 '=== put installto to choose disk 0 partition 0
archs01 = array("amd64") '=== architecture
'archs01 = array("x86", "amd64") '=== architecture
'=== create xml
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Set objIntro = xmlDoc.createProcessingInstruction("xml","version='1.0' encoding='UTF-8'")
xmlDoc.insertBefore objIntro,xmlDoc.childNodes(0)
Set objxmlchild01 = xmlDoc.createElement("unattend")
objxmlchild01.SetAttribute "xmlns", "urn:schemas-microsoft-com:unattend"
xmlDoc.appendChild objxmlchild01
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "windowsPE"
objxmlchild01.appendChild objxmlchild02
'=== Microsoft-Windows-International-Core-WINPE
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-International-Core-WinPE"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("SetupUILanguage")
objxmlchild03.appendChild objxmlchild04
'=== france setup cause canada does not exist in winpe
Set objxmlchild05 = xmlDoc.createElement("UILanguage")
objxmlchild05.text = UILanguage01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild04 = xmlDoc.createElement("InputLocale")
objxmlchild04.text = InputLocale01
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("SystemLocale")
objxmlchild04.text = SystemLocale01
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguage")
objxmlchild04.text = UILanguage02
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguageFallback")
objxmlchild04.text = UILanguageFallback01
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UserLocale")
objxmlchild04.text = UserLocale01
objxmlchild03.appendChild objxmlchild04
next
'===Microsoft-Windows-Setup
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Setup"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("ImageInstall")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("OSImage")
objxmlchild04.appendChild objxmlchild05
if installfromtag01 = 1 then
'=== choose image in index1 in dvd (wim index)
Set objxmlchild06 = xmlDoc.createElement("InstallFrom")
objxmlchild05.appendChild objxmlchild06
Set objxmlchild07 = xmlDoc.createElement("MetaData")
objxmlchild07.SetAttribute "wcm:action", "add"
objxmlchild06.appendChild objxmlchild07
Set objxmlchild08 = xmlDoc.createElement("Value")
objxmlchild08.text = "1"
objxmlchild07.appendChild objxmlchild08
Set objxmlchild08 = xmlDoc.createElement("key")
objxmlchild08.text = "/IMAGE/INDEX"
objxmlchild07.appendChild objxmlchild08
end if
'=== installto
if installtotag01 = 1 then
Set objxmlchild06 = xmlDoc.createElement("InstallTo")
objxmlchild05.appendChild objxmlchild06
Set objxmlchild07 = xmlDoc.createElement("DiskID")
objxmlchild07.text = "0"
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("PartitionID")
objxmlchild07.text = "1"
objxmlchild06.appendChild objxmlchild07
end if
Set objxmlchild06 = xmlDoc.createElement("InstallToAvailablePartition")
objxmlchild06.text = "false"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("WillShowUI")
objxmlchild06.text = "OnError"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild04 = xmlDoc.createElement("UserData")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("AcceptEula")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("FullName")
objxmlchild05.text = fullname01
objxmlchild04.appendChild objxmlchild05
if len(Organization01) > 0 then
Set objxmlchild05 = xmlDoc.createElement("Organization")
objxmlchild05.text = organization01
objxmlchild04.appendChild objxmlchild05
end if
Set objxmlchild05 = xmlDoc.createElement("ProductKey")
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Key")
objxmlchild06.text = productkey01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild04 = xmlDoc.createElement("EnableFirewall")
objxmlchild04.text = enablefirewall01
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-LUA-Settings
for each arch01 in archs01
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "offlineServicing"
objxmlchild01.appendChild objxmlchild02
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-LUA-Settings"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("EnableLUA")
objxmlchild04.text = "false"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-Security-SPP
for each arch01 in archs01
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "generalize"
objxmlchild01.appendChild objxmlchild02
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Security-SPP"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("SkipRearm")
objxmlchild04.text = "1"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-International-Core
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "specialize"
objxmlchild01.appendChild objxmlchild02
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-International-Core"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
'=== canada quebec setup language here
Set objxmlchild04 = xmlDoc.createElement("InputLocale")
objxmlchild04.text = InputLocale11
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("SystemLocale")
objxmlchild04.text = SystemLocale11
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguage")
objxmlchild04.text = UILanguage12
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UILanguageFallback")
objxmlchild04.text = UILanguageFallback11
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("UserLocale")
objxmlchild04.text = UserLocale11
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-Security-SPP-UX
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Security-SPP-UX"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("SkipAutoActivation")
objxmlchild04.text = "true"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-SQMApi
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-SQMApi"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("CEIPEnabled")
objxmlchild04.text = "0"
objxmlchild03.appendChild objxmlchild04
next
'=== Microsoft-Windows-Shell-Setup"
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Shell-Setup"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
if len(computername01)<>0 then
Set objxmlchild04 = xmlDoc.createElement("ComputerName")
objxmlchild04.text = computername01
objxmlchild03.appendChild objxmlchild04
end if
Set objxmlchild04 = xmlDoc.createElement("ProductKey")
objxmlchild04.text = productkey01
objxmlchild03.appendChild objxmlchild04
next
'=== oobeSystem
Set objxmlchild02 = xmlDoc.createElement("settings")
objxmlchild02.SetAttribute "pass", "oobeSystem"
objxmlchild01.appendChild objxmlchild02
for each arch01 in archs01
Set objxmlchild03 = xmlDoc.createElement("component")
objxmlchild03.SetAttribute "name", "Microsoft-Windows-Shell-Setup"
objxmlchild03.SetAttribute "processorArchitecture", arch01
objxmlchild03.SetAttribute "publicKeyToken", "31bf3856ad364e35"
objxmlchild03.SetAttribute "language", "neutral"
objxmlchild03.SetAttribute "versionScope", "nonSxS"
objxmlchild03.SetAttribute "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State"
objxmlchild03.SetAttribute "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
objxmlchild02.appendChild objxmlchild03
Set objxmlchild04 = xmlDoc.createElement("AutoLogon")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("Password")
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Value")
objxmlchild06.text = password01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("PlainText")
objxmlchild06.text = "true"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild05 = xmlDoc.createElement("Enabled")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("Username")
objxmlchild05.text = username01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild04 = xmlDoc.createElement("OOBE")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("HideEULAPage")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("HideOEMRegistrationScreen")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("HideOnlineAccountScreens")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("HideWirelessSetupInOOBE")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("NetworkLocation")
objxmlchild05.text = NetworkLocation01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("SkipUserOOBE")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("SkipMachineOOBE")
objxmlchild05.text = "true"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild05 = xmlDoc.createElement("ProtectYourPC")
objxmlchild05.text = ProtectYourPC01
objxmlchild04.appendChild objxmlchild05
Set objxmlchild04 = xmlDoc.createElement("UserAccounts")
objxmlchild03.appendChild objxmlchild04
Set objxmlchild05 = xmlDoc.createElement("LocalAccounts")
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("LocalAccount")
objxmlchild06.SetAttribute "wcm:action", "add"
objxmlchild05.appendChild objxmlchild06
Set objxmlchild07 = xmlDoc.createElement("Password")
objxmlchild07.text = password01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild08 = xmlDoc.createElement("Value")
objxmlchild08.text = password01
objxmlchild07.appendChild objxmlchild08
Set objxmlchild08 = xmlDoc.createElement("PlainText")
objxmlchild08.text = "true"
objxmlchild07.appendChild objxmlchild08
Set objxmlchild07 = xmlDoc.createElement("Description")
objxmlchild07.text = description01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("DisplayName")
objxmlchild07.text = displayname01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("Group")
objxmlchild07.text = group01
objxmlchild06.appendChild objxmlchild07
Set objxmlchild07 = xmlDoc.createElement("Name")
objxmlchild07.text = name01
objxmlchild06.appendChild objxmlchild07
if len(RegisteredOrganization01)>0 then
Set objxmlchild04 = xmlDoc.createElement("RegisteredOrganization")
objxmlchild04.text = RegisteredOrganization01
objxmlchild03.appendChild objxmlchild04
end if
if len(RegistredOwner01)>0 then
Set objxmlchild04 = xmlDoc.createElement("RegisteredOwner")
objxmlchild04.text = RegistredOwner01
objxmlchild03.appendChild objxmlchild04
end if
Set objxmlchild04 = xmlDoc.createElement("DisableAutoDaylightTimeSet")
objxmlchild04.text = "false"
objxmlchild03.appendChild objxmlchild04
Set objxmlchild04 = xmlDoc.createElement("FirstLogonCommands")
objxmlchild03.appendChild objxmlchild04
d = firstlogoncommands(objxmlchild04)
Set objxmlchild04 = xmlDoc.createElement("TimeZone")
objxmlchild04.text = timezone01
objxmlchild03.appendChild objxmlchild04
next
'=== 64 bits
fil02.WriteLine date & " " & time & " Saving xml file: " & filenamefullxml02
xmlDoc.Save filenamefullxml02
fil02.WriteLine date & " " & time & " END"
fil02.close
'=======================================
function firstlogoncommands(objxmlchild04)
order01 = 0
filenamefull01 = basedir & "SynchronousCommand03_common.txt"
fil02.WriteLine date & " " & time & " common synchronous commands: " & filenamefull01
Set File01 = objFSo.OpenTextFile(filenamefull01, 1, true)
'=== read filed names (1st line)
totline01 = 0
Do While file01.AtEndOfStream <> True
err01 = 0: err02 = "": on error resume next
line01 = file01.readline
line02 = file01.readline
line03 = file01.readline
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
err01 = 0: err02 = "": on error resume next
line01 = line01 + 1 '=== check if it is a number
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
totline01 = totline01 + 3
Set objxmlchild05 = xmlDoc.createElement("SynchronousCommand")
objxmlchild05.SetAttribute "wcm:action", "add"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Description")
objxmlchild06.text = line02
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("Order")
order01 = order01 + 1
objxmlchild06.text = order01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("CommandLine")
objxmlchild06.text = line03
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("RequiresUserInput")
objxmlchild06.text = "false"
objxmlchild05.appendChild objxmlchild06
else
fil02.WriteLine date & " " & time & " ERROR data integrity, need 1 number, description, command: " & totline01
end if
else
fil02.WriteLine date & " " & time & " ERROR reading line at: " & totline01
end if
loop
file01.close
if config01 = 1 then
filenamefull02 = basedir & "SynchronousCommand01_maison.txt"
elseif config01 = 2 then
filenamefull02 = basedir & "SynchronousCommand02_job.txt"
end if
fil02.WriteLine date & " " & time & " maison or job synchronous commands: " & filenamefull02
Set File02 = objFSo.OpenTextFile(filenamefull02, 1, true)
'=== read filed names (1st line)
totline01 = 0
Do While file02.AtEndOfStream <> True
err01 = 0: err02 = "": on error resume next
line01 = file02.readline
line02 = file02.readline
line03 = file02.readline
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
err01 = 0: err02 = "": on error resume next
line01 = line01 + 1 '=== check if it is a number
err01 = err.number: err02 = err.message: on error goto 0
if err01 = 0 then
totline01 = totline01 + 3
Set objxmlchild05 = xmlDoc.createElement("SynchronousCommand")
objxmlchild05.SetAttribute "wcm:action", "add"
objxmlchild04.appendChild objxmlchild05
Set objxmlchild06 = xmlDoc.createElement("Description")
objxmlchild06.text = line02
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("Order")
order01 = order01 + 1
objxmlchild06.text = order01
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("CommandLine")
objxmlchild06.text = line03
objxmlchild05.appendChild objxmlchild06
Set objxmlchild06 = xmlDoc.createElement("RequiresUserInput")
objxmlchild06.text = "false"
objxmlchild05.appendChild objxmlchild06
else
fil02.WriteLine date & " " & time & " ERROR data integrity, need 1 number, description, command: " & totline01
end if
else
fil02.WriteLine date & " " & time & " ERROR reading line at: " & totline01
end if
loop
file02.close
end function
Subscribe to:
Posts (Atom)