Permalink
Switch branches/tags
Nothing to show
Find file Copy path
bda90e0 Sep 10, 2018
1 contributor

Users who have contributed to this file

59 lines (45 sloc) 2.1 KB
<job id="Config-EnableWindowsStoreUpdates">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
oLogging.CreateEntry "Getting current OS drive letter...", LogTypeInfo
sSystemDrive = oEnvironment.Item("OSDTARGETDRIVECACHE")
If sSystemDrive = "" Then
oLogging.CreateEntry "Could not find the Windows volume via OSDTARGETDRIVECACHE variable. Guessing it's on D:" & sSystemDrive, LogTypeInfo
sSystemDrive = "D:"
End If
oLogging.CreateEntry "Current OS drive letter is " & sSystemDrive, LogTypeInfo
oLogging.CreateEntry "About to configure offline registry settings", LogTypeInfo
UpdateOfflineRegistry(sSystemDrive)
Function UpdateOfflineRegistry(sSystemDrive)
oLogging.CreateEntry "Unload the offline registry file", LogTypeInfo
bFound = False
For each sDir in oFSO.GetFolder(sSystemDrive & "\").Subfolders
If oFSO.FileExists(sDir & "\system32\config\software") then
oLogging.CreateEntry "Trying to load registry file " & sDir & "\system32\config\software", LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("reg load HKLM\NewOS """ & sDir & "\system32\config\software""")
If iRetVal = SUCCESS then
bFound = True
exit for
End if
End If
Next
If not bFound then
oLogging.CreateEntry "Unable to find the new OS registry file; Windows Store settings cannot be updated.", LogTypeError
UpdateOfflineRegistry = Success
EXIT FUNCTION
End If
oLogging.CreateEntry "Enable Windows Store Updates", LogTypeInfo
oShell.RegWrite "HKEY_LOCAL_MACHINE\NewOS\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate\AutoDownload", "4", "REG_DWORD"
' 2 = always off
' 4 = always on
oLogging.CreateEntry "Enable Consumer Experience", LogTypeInfo
oShell.RegWrite "HKEY_LOCAL_MACHINE\NewOS\Policies\Microsoft\Windows\CloudContent\DisableWindowsConsumerFeatures", "0", "REG_DWORD"
' 1 = Off (disabled)
' 0 = On (enabled)
oLogging.CreateEntry "Unload the offline registry file", LogTypeInfo
wscript.sleep 3000
oShell.Run "reg unload HKLM\NewOS", 0, true
UpdateOfflineRegistry = Success
End Function
</script>
</job>