FOG + Sysprep + Windows 10 1803
-
@george1421
You launch this command before upload your image (with upper U) :c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /unattend:C:\Windows\Panther\Unattend.xml
And in your post-install script you copy and sed unattend.xml (lower case)
You keep Unattend.xml or your delete him in your post-install script ?
Or you keep unattend.xml and Unattend.xml in the same folder ?Regards
-
Yes I run sysprep before capture. I have sysprep power off the computer to ensure the disk is closed correctly. I schedule the capture task in FOG, then pxe boot the computer into FOG image capture.
The Unattend.xml is on the computer before I sysprep it. There are bits that sysprep reads when its preparing the system for cloning. Then my sed script only updates the in place Unattend.xml file.
With that said, I have been known to use the fog post install script to insert a new Unattend.xml file if I discover a bug while perfecting the Unattend.xml file. This keeps me from having to recapture an image just because of a bad setting in the unattend.xml file. When I have all of the settings correct in the unattend.xml file I will rebuild the reference image and install the corrected unattend.xml file in the final golden image and stop the post install script copy job.
-
@george1421 ,
Not better
Maybe this comes from Active Directory -
@florent So just to be clear, your sed script IS UPDATING your unattend.xml file, but your system is not being renamed during OOBE? You can view your unattend.xml file in c:\windows\panther and it is for sure updated?
-
Hi George,
Yes
This is exactly what I do :
ComputerName of on my windows image template : MASTER10
Sysprep c:\Windows\Panther\Unattend.xml (source of you ,adaped to me) :
<?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>fr-FR</UILanguage> </SetupUILanguage> <InputLocale>040c:0000040c</InputLocale> <SystemLocale>fr-FR</SystemLocale> <UILanguage>fr-FR</UILanguage> <UILanguageFallback>fr-FR</UILanguageFallback> <UserLocale>fr-FR</UserLocale> </component> <component name="Microsoft-Windows-PnpCustomizationsWinPE" 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"> <DriverPaths> <PathAndCredentials wcm:action="add" wcm:keyValue="1"> <Path>C:\drivers</Path> </PathAndCredentials> </DriverPaths> </component> </settings> <settings pass="offlineServicing"> <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" 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"> <DriverPaths> <PathAndCredentials wcm:action="add" wcm:keyValue="1"> <Path>C:\drivers</Path> </PathAndCredentials> </DriverPaths> </component> </settings> <settings pass="generalize"> <component name="Microsoft-Windows-Security-SPP" 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"> <SkipRearm>1</SkipRearm> </component> </settings> <settings pass="specialize"> <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>040c:0000040c</InputLocale> <SystemLocale>fr-FR</SystemLocale> <UILanguage>fr-FR</UILanguage> <UILanguageFallback>fr-FR</UILanguageFallback> <UserLocale>fr-FR</UserLocale> </component> <component name="Microsoft-Windows-Security-SPP-UX" 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"> <SkipAutoActivation>true</SkipAutoActivation> </component> <component name="Microsoft-Windows-SQMApi" 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"> <CEIPEnabled>0</CEIPEnabled> </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"> <ComputerName>W10CBB</ComputerName> <CopyProfile>false</CopyProfile> <RegisteredOrganization>UR2</RegisteredOrganization> <RegisteredOwner>DSI</RegisteredOwner> <TimeZone>Romance 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>mydomain.com</Domain> <Password>*****</Password> <Username>*****</Username> </Credentials> <JoinDomain>mydomain.com</JoinDomain> <MachineObjectOU>dc=mydomain,dc=com</MachineObjectOU> </Identification> </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"> <OOBE> <HideEULAPage>true</HideEULAPage> <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> <HideOnlineAccountScreens>true</HideOnlineAccountScreens> <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> <NetworkLocation>Work</NetworkLocation> <SkipUserOOBE>true</SkipUserOOBE> <SkipMachineOOBE>true</SkipMachineOOBE> <ProtectYourPC>1</ProtectYourPC> <HideLocalAccountScreen>true</HideLocalAccountScreen> </OOBE> <RegisteredOrganization>UR2</RegisteredOrganization> <RegisteredOwner>DSI</RegisteredOwner> <TimeZone>Romance Standard Time</TimeZone> </component> </settings> <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> </unattend>
Before upload image :
c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /unattend:C:\Windows\Panther\Unattend.xml
Upload with FOG and deploy on other computer in debug mode
Verify if correct value :
echo $hostname => UC7774
echo $hostadouOk
ls /mnt/win/Windows/Panther/
Here i have problem because i have Unattend.xml but not unattend.xml (lower case)
I don’t know what i have foget ?sed -i -e "s#<ComputerName>\([^<][^<]*\)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi" /mnt/win/Windows/Panther/unattend.xml
=> Not such file or directory
sed -i -e "s#<MachineObjectOU>\([^<][^<]*\)</MachineObjectOU>#<MachineObjectOU>$hostadou</MachineObjectOU>#gi" /mnt/win/Windows/Panther/unattend.xml
=> Not such file or directory
I try anyway with Unattend.xml :
sed -i -e "s#<ComputerName>\([^<][^<]*\)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi" /mnt/win/Windows/Panther/Unattend.xml
=> Ok
sed -i -e "s#<MachineObjectOU>\([^<][^<]*\)</MachineObjectOU>#<MachineObjectOU>$hostadou</MachineObjectOU>#gi" /mnt/win/Windows/Panther/Unattend.xml
=> Ok
Vérify result of sed :
cat /mnt/win/Windows/Panther/Unattend.xml | less
Ok good value
Reboot => computer join domain correctly in the correct OU but always named is WIN-XXXXX …
If i try
c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /unattend:C:\Windows\System32\Sysprep\sysprep.xml
Upload
After deploy in debug mode if i do ls /mnt/win/Windows/Panther/ here i have the unattend.xml (lower case)
I do same operation with sed but always WIN-XXXXMaybe problem is here ?
Which is weird is the error on log file C:\Windows\Panther\UnattendGC\setupact.log :
[Shell Unattend] Running ‘specialize’ pass
[Shell Unattend] ComputerName in unattend [UC7774] matches the current ComputerName [UC7774]
[Shell Unattend] Skipping setting the same ComputerNameI don’t understand because my template windows i uploaded not have this computer name.
I hope i am clear but i don’t speak very good english.
I have also test to set in template image : Unattend.xml with UC7774 and correct OU with
c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /unattend:C:\Windows\Panther\Unattend.xml
If i reboot my template it’s correct named UC7774 and joined to domain
I don’t understand where is the problem
Regards
-
@florent said in FOG + Sysprep + Windows 10 1803:
/mnt/win/Windows/Panther/unattend.xml
well of course you know the lower case unattend.xml is wrong, correct?
Can you post what your post install scripts look like? I’m mainly interested in the script that renames the computer.
HINT: Your english is better than mine
-
@florent said in FOG + Sysprep + Windows 10 1803:
Reboot => computer join domain correctly in the correct OU but always named is WIN-XXXXX
Just a minute. I remember reading something about this. I seem to remember it was a windows 10 feature not a bug.
-
@george1421
Sorry i don’t understand, what do you mean by :
well of course you know the lower case unattend.xml is wrong, correct?For this test, i took this post install script, just putting commands in debug mode (shell) :
#!/bin/sh # . /usr/share/fog/lib/funcs.sh hd="" getHardDisk sysproduct="" doInventory modele=$(echo $sysproduct|tr 'A-Z' 'a-z') modele=$(echo $modele|sed -e 's/ //g') # Récupération des infos du host a partir de FOG wget -q -U '' -O /tmp/hinfo.txt "${web}service/hostinfo.php?mac=$mac" chmod +x /tmp/hinfo.txt . /tmp/hinfo.txt if [ "$mode_r2" = "debug" ] ; then bash fi if [ -n "$hd" ]; then partsys=$hd'1' partdata=$hd'2' echo "* Using disk device : $hd" echo "* Partition système : $partsys" echo "* Partition de données : $partdata" if [ "$mode_r2" = "debug" ] ; then # Here i put my command for sysprep bash fi echo "=> Copy Drivers" cd /mnt/win/ if [ -e "/mnt/win/drivers" ] ; then rm -r /mnt/win/drivers fi cp -a /mnt/clonages/pilotes/${modele}/${osid}/drivers /mnt/win cd umount /mnt/win rm -f /tmp/hinfo.txt fi
-
@florent If you want FOG to do this automatically these command should be in a script that is called every time the system is imaged.
I would think YOUR post install script would look similar to my scripts here:
https://forums.fogproject.org/topic/8889/fog-post-install-script-for-win-driver-injection/6I would guess that you don’t need the fog.drivers and the fog.log scripts only fog.postdownload and fog.ad scripts. Then you would update the fog.postdownload script to only call the fog.ad script.
echo "Done" debugPause # . ${postdownpath}fog.log # . ${postdownpath}fog.drivers . ${postdownpath}fog.ad umount /ntfs ;;
-
I’m currently deploying a Win10 1803 image to a computer in my office. I want to make sure I don’t speak wrong about it working like I say. I don’t deploy every day so I would to check to be sure.
-
@george1421 Yes the scripts are still working with 1803 to rename the host.
-
@george1421
Yes i added what i have in my postinstall script (remember finally not empty)
You see bad things in this ? -
@florent Not if it works you can do what ever you want. My plan was to provide people with scripts they can copy and paste into their FOG server so its easy.
-
@george1421
Ok i hope problem comes from my postinstall scripts.
I will try this likes yoursThanks for runway
-
@george1421
Hi George,
I advanced on the problem and i am very confused…
I identify problem is just after post download scripts.
I say that because in my multiple tests if i shutdown computer just after sed, cancel fog tasks and boot on Windows 10 1803 the name is correct !See screenshot of step where i ientify problem occurs :
In tests where windows computer name is correct i shutdown computer just before this screen.As i saw rubric “Changing hostname” i search in my web FOG Settings :
-FOG Client - Hostname Changer was enabled : Now DISABLED
-General Settings / Change Hostname early was enabled : Now DISABLEDAfter disable this two settings it’s ok …
2 months to identify this !
Problem solved.Very thanks for your helps and guidance to post download scripts.
I was convinced that it was coming from Windows/Sysprep.Don’t know why that did not bother Windows 10 1709.
Thanks again