locked
Variable to call local deployment drive during LiteTouch WSF Script. RRS feed

  • Question

  • Kinda new to WSF.

    Trying to set the target path for a copy command to be "%SystemDrive%\ProgramData\Microsoft\Use Account Pictures"

    		SourcePath = oUtility.ScriptDir & "\Default User Images\Win10\UserIcons\"		
    		TargetPath = (oEnv("Systemdrive")) & "\ProgramData\Microsoft\User Account Pictures\"
    		'TargetPath = "E:\ProgramData\Microsoft\User Account Pictures\"
    


    I don't want to hard code E: in there since it won't always be E:

    And it turns out "oEnv("Systemdrive")" is the the WinPE drive (X:)

    What Var should I be using to call the local deployment root?

    Thanks!

    -Matt


    There's no place like 127.0.0.1

    Monday, October 26, 2015 11:29 PM

All replies

  • oUtility.GetOSTargetDriveLetter


    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    Tuesday, October 27, 2015 12:41 AM
  • Tuesday, October 27, 2015 1:27 AM
  • In your task sequence edit the Format and Partition Disk action

    Select your Windows volume, and click the edit button (in between the yellow star and the cross) then at the bottom where it says Advanced Options add a variable, for example OSDisk.

    Now, in your script you may access the variable OSDisk which will equal E: or C: or whatever drive happens to have been assigned to the main Windows partition.

    Such as:

    TargetPath =oEnvironment.Item("OSDisk") & "\ProgramData\Microsoft\User Account Pictures\"

    • Proposed as answer by Ty Glander Tuesday, October 27, 2015 5:36 PM
    • Unproposed as answer by Matt5150 Tuesday, December 8, 2015 8:42 PM
    Tuesday, October 27, 2015 8:36 AM
  • Great, my tasks already had that OSDisk variable so I just needed to modify my WSF script.  Giving it a go now.

    Thanks!


    There's no place like 127.0.0.1

    Tuesday, October 27, 2015 4:12 PM
  • Hmm, getting this now.  Do I need to define that somehow, first?

    Microsoft Deployment Toolkit version: 6.3.8298.1000	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    The task sequencer log is located at X:\windows\TEMP\SMSTSLog\SMSTS.LOG.  For task sequence failures, please consult this log.	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    FAILURE (Err): 506: Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    FAILURE ( 5400 ): Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    Event 41002 sent: FAILURE ( 5400 ): Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    


    There's no place like 127.0.0.1

    Tuesday, October 27, 2015 6:07 PM
  • Hmm, getting this now.  Do I need to define that somehow, first?

    Microsoft Deployment Toolkit version: 6.3.8298.1000	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    The task sequencer log is located at X:\windows\TEMP\SMSTSLog\SMSTS.LOG.  For task sequence failures, please consult this log.	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    FAILURE (Err): 506: Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    FAILURE ( 5400 ): Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)
    Event 41002 sent: FAILURE ( 5400 ): Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined	CustomCopyFiles-Win10	10/27/2015 5:53:06 PM	0 (0x0000)


    There's no place like 127.0.0.1

    Fixed this, I was missing a line after editing.

    There's no place like 127.0.0.1

    Tuesday, October 27, 2015 8:02 PM
  • Take that back, I just broke my script entirely somehow.  Litetouch now behaves as if it can't find the script at all.  I've verified all the paths in the TS and such.

    I recreated it from scratch (based of LTICopyScripts.wsf), but still having the same problem.  

    Is there something in the script that would be causing Litetouch to report:

    Litetouch deployment failed, Return Code = -2147467259 0x80004005

    Can't find any other log info about it.

    Script:

    <job id="CustomUserImages-Win10">
    	<script language="VBScript" src="ZTIUtility.vbs"/>
    	<script language="VBScript">
    
    ' // ***************************************************************************
    ' // 
    ' // Microsoft Deployment Toolkit Solution Accelerator
    ' //
    ' // File:      CustomUserImages-Win10.wsf
    ' // 
    ' // Version:   6.3.8298.1000
    ' // 
    ' // Purpose:   Copy the Custom Files to the local drive.
    ' // 
    ' // Usage:     cscript.exe [//nologo] CustomUserImages-Win10.wsf [/debug:true]
    ' // 
    ' // ***************************************************************************
    
    Option Explicit
    RunNewInstance
    
    
    '//----------------------------------------------------------------------------
    '//  Main Class
    '//----------------------------------------------------------------------------
    
    Class CustomUserImages-Win10
    
    	'//----------------------------------------------------------------------------
    	'//  Class instance variable declarations
    	'//----------------------------------------------------------------------------
    
    	Public FilesToCopy
    	Public SourcePath
    	Public TargetPath
    	
    
    	'//----------------------------------------------------------------------------
    	'//  Constructor to initialize needed global objects
    	'//----------------------------------------------------------------------------
    
    	Private Sub Class_Initialize
    
    		' Create a list of scripts to copy.
    		
    		FilesToCopy = Array("guest.bmp", "guest.png", "user.bmp", "user.png", _
    			"user-32.png", "user-40.png", "user-48.png", "user-192.png")
    			
    		SourcePath = oUtility.ScriptDir & "\Default User Images\Win10\UserIcons\"			
    		TargetPath = oEnvironment.Item("OSDisk") & "\ProgramData\Microsoft\User Account Pictures\"
    						
    
    	End Sub
    	
    	
    	'//----------------------------------------------------------------------------
    	'//  Main routine
    	'//----------------------------------------------------------------------------
    
    		oUtility.VerifyPathExists oEnvironment.Item("OSDisk") & "\ProgramData\Microsoft\User Account Pictures\"
    
    		For each sFile in FilesToCopy
    
    			sTarget = TargetPath & sFile
    			sSource = SourcePath & sFile
    
    			oLogging.CreateEntry "Copying file " & sSource & " to " & sTarget, LogTypeInfo
    			oFSO.CopyFile sSource, sTarget, true
    			TestAndLog SUCCESS, "Copy " & sSource & " to " & sTarget
    		Next
    		
    		Main = SUCCESS
    
    	End Function
    
    
    End class
    
    
    	</script>
    </job>
    


    There's no place like 127.0.0.1

    Tuesday, October 27, 2015 9:08 PM
  • Can I assume your script is in the same directory as ZTIUtility?

    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    Wednesday, October 28, 2015 7:26 AM
  • Take out the "-" from the file name, class name and Job ID.

    The easiest way to debug these things is to run the script from the command line outside of the task sequence. That's what I just did and it took me straight to the error.

    Wednesday, October 28, 2015 10:10 AM
  • Can I assume your script is in the same directory as ZTIUtility?

    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    Yes.  Same directory.


    There's no place like 127.0.0.1

    Wednesday, October 28, 2015 5:49 PM
  • This

    <job id="CustomUserImages-Win10">
    	<script language="VBScript" src="ZTIUtility.vbs"/>
    	<script language="VBScript">

    Needs to be changed to:

    <job id="CustomUserImages-Win10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript">

    At least that's what I do in my scripts and they work fine when referencing ZTIUtility

    Also your script is missing parts to make it work. I'll work on it and repost


    If this post is helpful please vote it as Helpful or click Mark for answer.



    • Edited by Dan_Vega Wednesday, October 28, 2015 6:28 PM
    Wednesday, October 28, 2015 6:18 PM
  • Take out the "-" from the file name, class name and Job ID.

    The easiest way to debug these things is to run the script from the command line outside of the task sequence. That's what I just did and it took me straight to the error.

    Hyphen removed (from script and name).  Same error.

    If I have that step Continue on Error, the TS completes without error, and there is no log referencing this script.

    When I run it from CMD, I get:

    FAILURE (Err): 506: Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined
    FAILURE ( 5400 ): Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined
    -Matt


    There's no place like 127.0.0.1

    Wednesday, October 28, 2015 6:58 PM
  • This

    <job id="CustomUserImages-Win10">
    	<script language="VBScript" src="ZTIUtility.vbs"/>
    	<script language="VBScript">

    Needs to be changed to:

    <job id="CustomUserImages-Win10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript">

    At least that's what I do in my scripts and they work fine when referencing ZTIUtility

    Also your script is missing parts to make it work. I'll work on it and repost


    If this post is helpful please vote it as Helpful or click Mark for answer.



    If I copy CustomUserImagesW10.wsf to C: and run it via CSCRIPT.exe, I get an error that it can't find ZTIUtility.vbs.  If I then copy ZTIUtility.vbs to C: and run my script, I get this error:

    FAILURE (Err): 506: Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined
    FAILURE ( 5400 ): Create object: Set oScriptClass = New CustomCopyFiles-Win10 - Class not defined


    There's no place like 127.0.0.1

    Wednesday, October 28, 2015 7:00 PM
  • That's because it's not designed to run that way, also your script is using undeclared variables. I'm working on it.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Wednesday, October 28, 2015 7:29 PM
  • See if this works. But note the files you are copying need to be in folder Win10\UserIcons and that should be located in your scripts folder.

    <job id="CustomUserImages-Win10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript">
    
    ' // ***************************************************************************
    ' //
    ' // File:      CustomUserImages-Win10.wsf
    ' // 
    ' // Version:   1.0
    ' // 
    ' // Purpose:   Copy the Custom Files to the local drive.
    ' // 
    ' // Usage:     cscript.exe [//nologo] CustomUserImages-Win10.wsf [/debug:true]
    ' // 
    ' // ***************************************************************************
    
    Option Explicit
    RunNewInstance
    
    
    '//----------------------------------------------------------------------------
    '//  Main Class
    '//----------------------------------------------------------------------------
    
    Class CustomUserImages-Win10
    
    	'//----------------------------------------------------------------------------
    	'//  Global constant and variable declarations
    	'//----------------------------------------------------------------------------
    
    	Dim sDestinationDrive
    	
    	sDestinationDrive = oUtility.GetOSTargetDriveLetter
    
    	'//----------------------------------------------------------------------------
    	'//  Class instance variable declarations
    	'//----------------------------------------------------------------------------
    
    	Public FilesToCopy
    	Public SourcePath
    	Public TargetPath
    	
    
    	'//----------------------------------------------------------------------------
    	'//  Constructor to initialize needed global objects
    	'//----------------------------------------------------------------------------
    
    	Private Sub Class_Initialize
    
    		' Create a list of scripts to copy.
    		
    		FilesToCopy = Array("guest.bmp", "guest.png", "user.bmp", "user.png", _
    			"user-32.png", "user-40.png", "user-48.png", "user-192.png")
    			
    		SourcePath = oUtility.ScriptDir & "\Win10\UserIcons\"			
    		TargetPath = sDestinationDrive & "\ProgramData\Microsoft\User Account Pictures\"
    						
    
    	End Sub
    	
    	
    	'//----------------------------------------------------------------------------
    	'//  Main routine
    	'//----------------------------------------------------------------------------
    	
    	Function Main
    	
    		Dim sTarget
    		Dim sSource
    		Dim sFile
    		
    		oLogging.CreateEntry "--------- Script Start ---------", LogTypeInfo		
    	
    		'//----------------------------------------------------------------------------
    		'// Copy files to OS Target Drive
    		'//----------------------------------------------------------------------------
    
    		oUtility.VerifyPathExists sDestinationDrive & "\ProgramData\Microsoft\User Account Pictures\"
    
    		For each sFile in FilesToCopy
    
    			sTarget = TargetPath & sFile
    			sSource = SourcePath & sFile
    
    			oLogging.CreateEntry "Copying file " & sSource & " to " & sTarget, LogTypeInfo
    			oFSO.CopyFile sSource, sTarget, true
    			TestAndLog SUCCESS, "Copy " & sSource & " to " & sTarget
    			
    		Next
    		
    		Main = SUCCESS
    
    	End Function
    
    
    End class
    
    
    	</script>
    </job>


    If this post is helpful please vote it as Helpful or click Mark for answer.


    • Edited by Dan_Vega Wednesday, October 28, 2015 9:36 PM
    Wednesday, October 28, 2015 7:50 PM
  • Oh I understand.  I was just showing that I was getting the same error from above when ZTIUtility was present.

    Thanks.


    There's no place like 127.0.0.1

    Wednesday, October 28, 2015 8:41 PM
  • See if this works. But note the files you are copying need to be in folder Win10\UserIcons and that should be located in your scripts folder.

    Same error.  No log file generated.  No mention in E:\Windows\Temp\DeploymentLogs\BDD.log

    -Matt


    There's no place like 127.0.0.1

    Wednesday, October 28, 2015 10:00 PM
  • What is your file name? Is it's definitely CustomUserImages-Win10.wsf?

    I copied your script, renamed it and also renamed any reference in the script itself and it worked fine. If you have the physical file name different from the Class and Job ID then things won't work.

    I realise I'm repeating myself here and don't mean to offend by re-asking but there has to be some basic fundamental difference between what you're doing and what others are doing so it's worth checking things like this.

    Thursday, October 29, 2015 8:17 AM
  • What is your file name? Is it's definitely CustomUserImages-Win10.wsf?

    I copied your script, renamed it and also renamed any reference in the script itself and it worked fine. If you have the physical file name different from the Class and Job ID then things won't work.

    I realise I'm repeating myself here and don't mean to offend by re-asking but there has to be some basic fundamental difference between what you're doing and what others are doing so it's worth checking things like this.

    I completely agree.  I'll re-triple-check everything. ;)

    There's no place like 127.0.0.1

    Thursday, October 29, 2015 4:30 PM
  • My deployment share is at: \\MDTServer\Deploymaster$\

    My scripts are saved at: \\MDTServer\Deploymaster$\Scripts\

    My user images are saved at: \\MDTServer\Deploymaster$\Scripts\Win10\UserIcons

    Script is named: CustomUserImagesWin10.wsf *Removed the hyphen per suggestion above

    Script: *Hyphen also removed from script, edited with Notepad++

    <job id="CustomUserImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript">
    
    ' // ***************************************************************************
    ' //
    ' // File:      CustomUserImagesWin10.wsf
    ' // 
    ' // Version:   1.0
    ' // 
    ' // Purpose:   Copy the Custom Files to the local drive.
    ' // 
    ' // Usage:     cscript.exe [//nologo] CustomUserImagesWin10.wsf [/debug:true]
    ' // 
    ' // ***************************************************************************
    
    Option Explicit
    RunNewInstance
    
    
    '//----------------------------------------------------------------------------
    '//  Main Class
    '//----------------------------------------------------------------------------
    
    Class CustomUserImagesWin10
    
    	'//----------------------------------------------------------------------------
    	'//  Global constant and variable declarations
    	'//----------------------------------------------------------------------------
    
    	Dim sDestinationDrive
    	
    	sDestinationDrive = oUtility.GetOSTargetDriveLetter
    
    	'//----------------------------------------------------------------------------
    	'//  Class instance variable declarations
    	'//----------------------------------------------------------------------------
    
    	Public FilesToCopy
    	Public SourcePath
    	Public TargetPath
    	
    
    	'//----------------------------------------------------------------------------
    	'//  Constructor to initialize needed global objects
    	'//----------------------------------------------------------------------------
    
    	Private Sub Class_Initialize
    
    		' Create a list of scripts to copy.
    		
    		FilesToCopy = Array("guest.bmp", "guest.png", "user.bmp", "user.png", _
    			"user-32.png", "user-40.png", "user-48.png", "user-192.png")
    			
    		SourcePath = oUtility.ScriptDir & "\Win10\UserIcons\"			
    		TargetPath = sDestinationDrive & "\ProgramData\Microsoft\User Account Pictures\"
    						
    
    	End Sub
    	
    	
    	'//----------------------------------------------------------------------------
    	'//  Main routine
    	'//----------------------------------------------------------------------------
    	
    	Function Main
    	
    		Dim sTarget
    		Dim sSource
    		Dim sFile
    		
    		oLogging.CreateEntry "--------- Script Start ---------", LogTypeInfo		
    	
    		'//----------------------------------------------------------------------------
    		'// Copy files to OS Target Drive
    		'//----------------------------------------------------------------------------
    
    		oUtility.VerifyPathExists sDestinationDrive & "\ProgramData\Microsoft\User Account Pictures\"
    
    		For each sFile in FilesToCopy
    
    			sTarget = TargetPath & sFile
    			sSource = SourcePath & sFile
    
    			oLogging.CreateEntry "Copying file " & sSource & " to " & sTarget, LogTypeInfo
    			oFSO.CopyFile sSource, sTarget, true
    			TestAndLog SUCCESS, "Copy " & sSource & " to " & sTarget
    			
    		Next
    		
    		Main = SUCCESS
    
    	End Function
    
    
    End class
    
    
    	</script>
    </job>

    Portion of the TS that calls the script:

        <step name="Configure" disable="false" continueOnError="false" successCodeList="0 3010" description="" startIn="">
          <action>cscript.exe "%SCRIPTROOT%\ZTIConfigure.wsf"</action>
          <defaultVarList>
            <variable name="RunAsUser" property="RunAsUser">false</variable>
            <variable name="SMSTSRunCommandLineUserName" property="SMSTSRunCommandLineUserName"></variable>
            <variable name="SMSTSRunCommandLineUserPassword" property="SMSTSRunCommandLineUserPassword"></variable>
            <variable name="LoadProfile" property="LoadProfile">false</variable>
          </defaultVarList>
        </step>
        <group expand="true" name="PowerShell Tasks" description="" disable="false" continueOnError="false">
          <action />
          <step type="SMS_TaskSequence_RunCommandLineAction" name="Copy Custom Files" description="" disable="false" continueOnError="false" startIn="" successCodeList="0 3010" runIn="WinPEandFullOS">
            <defaultVarList>
              <variable name="PackageID" property="PackageID"></variable>
              <variable name="RunAsUser" property="RunAsUser">false</variable>
              <variable name="SMSTSRunCommandLineUserName" property="SMSTSRunCommandLineUserName"></variable>
              <variable name="SMSTSRunCommandLineUserPassword" property="SMSTSRunCommandLineUserPassword"></variable>
              <variable name="LoadProfile" property="LoadProfile">false</variable>
            </defaultVarList>
            <action>cscript.exe "%SCRIPTROOT%\CustomUserImagesWin10.wsf"</action>
          </step>

    -Matt


    There's no place like 127.0.0.1

    Thursday, October 29, 2015 5:02 PM
  • <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>

    This is a relative path.  ..\.. is common when you have a script in Applications\SomeApp. You need to fix that. 

    <script language="VBScript" src="ZTIUtility.vbs"/>
    Although if you wanted to import your script as an application then ..\..\scripts\ZTIUtility.vbs would work.


    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    • Proposed as answer by Ty Glander Thursday, October 29, 2015 8:24 PM
    • Unproposed as answer by Ty Glander Thursday, October 29, 2015 8:35 PM
    Thursday, October 29, 2015 8:24 PM
  • That's right. I usually import my scripts as an application and I have gotten used to using that path.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, October 29, 2015 8:29 PM
  • That's right. I usually import my scripts as an application and I have gotten used to using that path.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    TBH I think you did most of the help here. I only spotted one minor thing :)

    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    Thursday, October 29, 2015 8:36 PM
  • Change made.  Same error.

    Would the BDD.log be helpful?

    Google Drive > BDD.txt


    There's no place like 127.0.0.1


    • Edited by Matt5150 Thursday, October 29, 2015 8:59 PM BDD Log added.
    Thursday, October 29, 2015 8:50 PM
  • I honestly don't know where to go from here.  Andrew said he had your script working above. 

    Have you tried launching the script from a cmd prompt?


    Logs are very important. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Also if you have made customizations please mention them when asking for help.

    Thursday, October 29, 2015 9:03 PM
  • Looking at your log file I see no reference to your script. This is a reason I import them as apps, because then you would see a ZTI application, blah blah in the logs. I've noticed if you call up a script directly, you won't see log info about it.

    I also noticed your log file says "Unable to copy log to the network as no SLShare value was specified." You should make a share to store the logs.


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, October 29, 2015 9:13 PM
  • Looking at your log file I see no reference to your script. This is a reason I import them as apps, because then you would see a ZTI application, blah blah in the logs. I've noticed if you call up a script directly, you won't see log info about it.

    I also noticed your log file says "Unable to copy log to the network as no SLShare value was specified." You should make a share to store the logs.


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Apparently I got off, responding on the wrong thread.  Oops.

    Un-commented my SLShare= line.  Central logging is back!

    Same error, no new logs generated.

    I'm setting this up as an application now, and trying again.

    -Matt


    There's no place like 127.0.0.1

    Friday, October 30, 2015 5:10 PM
  • Created an application to run the script.  Edited ZTIUtility line to match:

    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>

    Error:

    BDD.log

    Application CustomUserImagesWin10 returned an unexpected return code: 1	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    

    ZTIApplications.log:

    Mandatory Single Application install indicated. Guid: {a6438b5c-b293-40e8-bff4-8ae1eac722a0}	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    ################	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Entry: {a6438b5c-b293-40e8-bff4-8ae1eac722a0}	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Name:  CustomUserImagesWin10	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    ################	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Validating connection to \\DistributionServer\DeployMaster$\Applications\CustomUserImagesWin10	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Mapping server share: \\DistributionServer\DeployMaster$	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Already connected to server DistributionServer as that is where this script is running from.	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    		Change directory: \\DistributionServer\DeployMaster$\Applications\CustomUserImagesWin10	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    		Run Command: \\DistributionServer\DeployMaster$\Tools\X64\bddrun.exe cscript.exe "CustomUserImagesWin10.wsf"	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    ZTI installing application 	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Event 41031 sent: ZTI installing application 	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    About to run command: \\DistributionServer\DeployMaster$\Tools\X64\bddrun.exe cscript.exe "CustomUserImagesWin10.wsf"	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Command has been started (process ID 1596)	ZTIApplications	10/30/2015 5:24:09 PM	0 (0x0000)
    Return code from command = 1	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    Application CustomUserImagesWin10 returned an unexpected return code: 1	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    Event 41034 sent: Application CustomUserImagesWin10 returned an unexpected return code: 1	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    Property InstalledApplications001 is now = {a6438b5c-b293-40e8-bff4-8ae1eac722a0}	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    ZTIApplications processing completed successfully.	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    Event 41001 sent: ZTIApplications processing completed successfully.	ZTIApplications	10/30/2015 5:24:10 PM	0 (0x0000)
    



    There's no place like 127.0.0.1

    Friday, October 30, 2015 6:07 PM
  • I ran it again, because the first time I ran it I never got a LiteTouch summary.  I had walked away and the VM was dark. I hit a bunch to keys to wake it and came up to a windows desktop.

    This 2nd time, I was watching it and I saw this message come up after booting into Windows.


    There's no place like 127.0.0.1

    Friday, October 30, 2015 6:27 PM
  • Well you're just replacing pictures, try running it during the State Restore phase.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, October 30, 2015 6:34 PM
  • You could go simple with a bit of logging:

    <job id="CustomUserImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to replace default user account pictures
    '// Usage: cscript CustomUserImagesWin10.wsf [/debug:true]
    '// Version: 1.0 - Initial script
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// Global constant and variable declarations
    '//---------------------------------------------------------------------------- 
    
    Option Explicit 
    
    Dim sProfile
    
    sProfile = oShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
    
    '//----------------------------------------------------------------------------
    '// End declarations
    '//---------------------------------------------------------------------------- 
    
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '// 
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '// 
    '//---------------------------------------------------------------------------
    Function ZTIProcess() 
    
    	oLogging.CreateEntry "CustomUserImagesWin10: Replacing user account pictures", LogTypeInfo	
    
    	' Replace User Account Pictures
    	oFSO.CopyFile oUtility.ScriptDir & "\*.png", sProfile & "\Microsoft\User Account Pictures\", True
    	oFSO.CopyFile oUtility.ScriptDir & "\*.bmp", sProfile & "\Microsoft\User Account Pictures\", True
    
    	oLogging.CreateEntry "CustomUserImagesWin10: Finished replacing user account pictures", LogTypeInfo	
    	
    End Function 
    
    </script>
    </job>


    If this post is helpful please vote it as Helpful or click Mark for answer.


    • Edited by Dan_Vega Friday, October 30, 2015 6:57 PM missed an edit
    Friday, October 30, 2015 6:54 PM
  • Not exactly.

    The whole reason I'm trying to do this during Postinstall is because once a user profile is created in Windows, those images are cached into other locations on the machine.

    Historically when I do these builds I run batch file I created to replace all the default images with our own.

    TAKEOWN.exe /F C:\ProgramData\Microsoft\Windows\SystemData /R /A /D y
    TAKEOWN.exe /F "C:\Windows\Web\4K\Wallpaper\Windows\*.jpg" /A
    TAKEOWN.exe /F "C:\Windows\Web\Screen\img100.jpg" /A
    TAKEOWN.exe /F "C:\Windows\Web\Wallpaper\Windows\img0.jpg" /A
    cacls "C:\ProgramData\Microsoft\Windows\SystemData" /T /G "Administrator":F /E
    cacls "C:\ProgramData\Microsoft\Windows\SystemData" /T /G "SYSTEM":F /E
    cacls "C:\Windows\Web\4K\Wallpaper\Windows\*.jpg" /T /G "Administrator":F /E
    cacls "C:\Windows\Web\Screen\img100.jpg" /T /G "Administrator":F /E
    cacls "C:\Windows\Web\Wallpaper\Windows\img0.jpg" /T /G "Administrator":F /E
    del /F /Q C:\ProgramData\Microsoft\Windows\SystemData\S-1-5-18\ReadOnly\LockScreen_Z\*.*
    del /F /Q "C:\ProgramData\Microsoft\User Account Pictures"\*.dat
    xcopy /e /y C:\Users\Administrator\Desktop\Win10\UserIcons\*.* "C:\ProgramData\Microsoft\User Account Pictures"
    xcopy /e /y C:\Users\Administrator\Desktop\Win10\WindowsWeb\4K\Wallpaper\Windows\*.* "C:\Windows\Web\4K\Wallpaper\Windows"
    xcopy /e /y C:\Users\Administrator\Desktop\Win10\WindowsWeb\Screen\*.* "C:\Windows\Web\Screen"
    xcopy /e /y C:\Users\Administrator\Desktop\Win10\WindowsWeb\Wallpaper\Windows\*.* "C:\Windows\Web\Wallpaper\Windows"
    cacls "C:\Windows\Web\4K\Wallpaper\Windows\*.jpg" /T /G "Administrators":F /E
    cacls "C:\Windows\Web\Screen\img100.jpg" /T /G "Administrators":F /E
    cacls "C:\Windows\Web\Wallpaper\Windows\img0.jpg" /T /G "Administrators":F /E
    cacls "C:\Windows\Web\4K\Wallpaper\Windows\*.jpg" /T /G "SYSTEM":F /E
    cacls "C:\Windows\Web\Screen\img100.jpg" /T /G "SYSTEM":F /E
    cacls "C:\Windows\Web\Wallpaper\Windows\img0.jpg" /T /G "SYSTEM":F /E
    cacls "C:\Windows\Web\4K\Wallpaper\Windows\*.jpg" /T /G "Users":R /E
    cacls "C:\Windows\Web\Screen\img100.jpg" /T /G "Users":R /E
    cacls "C:\Windows\Web\Wallpaper\Windows\img0.jpg" /T /G "Users":R /E

    The problem with this, is that the wallpapers and Lock screens are already pulled and cached from the default locations.  

    If:

    *The build hasn't activated by the time I go to capture

    *Administrator account isn't "logged off" first before the script is run

    *The wallpaper isn't manually changed back and forth once.

    *Replacing the files post logon / boot requires permissions on the files to be changed.

    The new images (wallpaper) won't work with Sysprep COPYPROFILE=True.

    I had some options.

    I could use DISM OFFLINE to inject them into the Install WIM.  But I'd rather always start with clean VLS media.

    I could try with PowerShell during Postinstall

     Using a PowerShell script in a Task Sequence to replace system files.

    I could try with WSF (this thread)

    So that's where I'm at.

    That said, I just tried running it in State Restore and got the same errors from above, minus the WinPE error.

    -Matt


    There's no place like 127.0.0.1

    Friday, October 30, 2015 7:00 PM
  • Wait are you trying to replace the default picture during deployment to the end user or when building your reference image. From the sound of it, you should be replacing them while you are building the reference image. But even if you replaced the pictures after the admin account has logged in, the administrator account will be the only one still using the Microsoft default picture, new users should grab the newly replaced png/bmp pictures.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, October 30, 2015 7:05 PM
  • Reference image.

    User picture seems to work that way, but not the lock screen and wallpaper.  COPYPROFILE=True seems to usethe cached reference when creating a new user profile.


    There's no place like 127.0.0.1


    • Edited by Matt5150 Friday, October 30, 2015 7:08 PM edit
    Friday, October 30, 2015 7:08 PM
  • I don't replace the Microsoft wallpapers, what I do is during the creation of my reference image I have a script that copies over some themes and pictures. Then in the unattend file of the task sequence to deploy to end users I set the "Theme" in the OOBE phase by providing a theme name, desktop background and window color.

    You could enforce a different lock screen with GP.


    If this post is helpful please vote it as Helpful or click Mark for answer.


    • Edited by Dan_Vega Friday, October 30, 2015 7:17 PM
    Friday, October 30, 2015 7:09 PM
  • I don't replace the Microsoft wallpapers, what I do is during the creation of my reference image I have a script that copies over some themes and pictures. Then in the unattend file of the task sequence to deploy to end users I set the "Theme" in the OOBE phase by providing a theme name, desktop background and window color.

    You could enforce a different lock screen with GP.


    If this post is helpful please vote it as Helpful or click Mark for answer.


    Explored all of those options back when I started doing this for Windows XP.  And again during Windows 7 and Windows 8.1 WIM creation.

    Deploying a default theme on our plethora of devices caused us some issues.  I believe Areo was one (Only Win7).  Screen resolutions were another, but there was one I can't recall at the moment that really made it a showstopper.

    We don't want to enforce any settings, just replace the default experience.

    There are other tasks I'd like to eventually use this solution for.  But so far I haven't been able to find a way to replace system files during Postinstall.


    There's no place like 127.0.0.1

    Friday, October 30, 2015 8:02 PM
  • You could go simple with a bit of logging:

    <job id="CustomUserImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to replace default user account pictures
    '// Usage: cscript CustomUserImagesWin10.wsf [/debug:true]
    '// Version: 1.0 - Initial script
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// Global constant and variable declarations
    '//---------------------------------------------------------------------------- 
    
    Option Explicit 
    
    Dim sProfile
    
    sProfile = oShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
    
    '//----------------------------------------------------------------------------
    '// End declarations
    '//---------------------------------------------------------------------------- 
    
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '// 
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '// 
    '//---------------------------------------------------------------------------
    Function ZTIProcess() 
    
    	oLogging.CreateEntry "CustomUserImagesWin10: Replacing user account pictures", LogTypeInfo	
    
    	' Replace User Account Pictures
    	oFSO.CopyFile oUtility.ScriptDir & "\*.png", sProfile & "\Microsoft\User Account Pictures\", True
    	oFSO.CopyFile oUtility.ScriptDir & "\*.bmp", sProfile & "\Microsoft\User Account Pictures\", True
    
    	oLogging.CreateEntry "CustomUserImagesWin10: Finished replacing user account pictures", LogTypeInfo	
    	
    End Function 
    
    </script>
    </job>


    If this post is helpful please vote it as Helpful or click Mark for answer.


    Same WinPE warning message.

    I'll move it to State Restore and try again.

    -Matt


    There's no place like 127.0.0.1

    Friday, October 30, 2015 8:18 PM
  • I don't replace the Microsoft wallpapers, what I do is during the creation of my reference image I have a script that copies over some themes and pictures. Then in the unattend file of the task sequence to deploy to end users I set the "Theme" in the OOBE phase by providing a theme name, desktop background and window color.

    You could enforce a different lock screen with GP.


    If this post is helpful please vote it as Helpful or click Mark for answer.


    Explored all of those options back when I started doing this for Windows XP.  And again during Windows 7 and Windows 8.1 WIM creation.

    Deploying a default theme on our plethora of devices caused us some issues.  I believe Areo was one (Only Win7).  Screen resolutions were another, but there was one I can't recall at the moment that really made it a showstopper.

    We don't want to enforce any settings, just replace the default experience.

    There are other tasks I'd like to eventually use this solution for.  But so far I haven't been able to find a way to replace system files during Postinstall.


    There's no place like 127.0.0.1

    I remember now, that the problem with the theme was again, Sysprep COPYPROFILE=True.  But I wasn't deploying it Unattend as you suggested.  I was applying it to the administrator profile, pre-capture.

    I'll give that a try.   But that doesn't address the other problems, or future use of this method I'm attempting.


    There's no place like 127.0.0.1

    Friday, October 30, 2015 8:21 PM
  • Ever since 8 I stopped using copy profile and set the theme using unattend. I get you want to create your own default theme and pictures without locking a user to that.

    It doesn't look like using group policy would prevent them from changing the lock screen because there's a separate policy for that.

    I haven't tested this but it looks like you can also set it using powershell.

    Set-ItemProperty HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization LockScreenImage "C:\Path\To\Image.png"


    If this post is helpful please vote it as Helpful or click Mark for answer.


    • Edited by Dan_Vega Friday, October 30, 2015 8:30 PM
    Friday, October 30, 2015 8:25 PM
  • Ever since 8 I stopped using copy profile and set the theme using unattend. I get you want to create your own default theme and pictures without locking a user to that.

    It doesn't look like using group policy would prevent them from changing the lock screen because there's a separate policy for that.


    If this post is helpful please vote it as Helpful or click Mark for answer.

    This is actually how I used to do it for the Windows 7 lock screens.

    Another downside to this is that all of our machines are not domain joined.  I could probably execute a script to apply it via registry or local security policy, but again this won't solve all of the problems above.

    Plus probably more than anything else, my OCD is now obsessed with making this work. :D


    There's no place like 127.0.0.1

    Friday, October 30, 2015 8:31 PM
  • I don't think they need to be domain joined, it says or unconditionally in Enterprise SKUs.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, October 30, 2015 8:36 PM
  • I don't think they need to be domain joined, it says or unconditionally in Enterprise SKUs.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Sorry, I meant the GPO portion only.  Without Domain membership, no GPO's.  But for other settings I apply those settings via Local Security Policy or the registry when possible.

    There's no place like 127.0.0.1

    Friday, October 30, 2015 8:41 PM
  • Oh yes sorry I wasn't specific, by group policy I meant open gpedit.msc on the reference machine and set the local policies.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, October 30, 2015 8:44 PM
  • You could go simple with a bit of logging:

    <job id="CustomUserImagesWin10"> <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/> <script language="VBScript"> ......

    End Function </script> </job>



    If this post is helpful please vote it as Helpful or click Mark for answer.


    Same WinPE warning message.

    I'll move it to State Restore and try again.

    -Matt


    There's no place like 127.0.0.1

    ZTIApplication.log

    After moving task to State Restore

    Microsoft Deployment Toolkit version: 6.3.8298.1000	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    The task sequencer log is located at C:\Users\ADMINI~1\AppData\Local\Temp\SMSTSLog\SMSTS.LOG.  For task sequence failures, please consult this log.	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Language/Locale Identified (in order of precedence): 1033,0409,0x0409,9,0009,0x0009	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Mandatory Single Application install indicated. Guid: {a6438b5c-b293-40e8-bff4-8ae1eac722a0}	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    ################	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Entry: {a6438b5c-b293-40e8-bff4-8ae1eac722a0}	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Name:  CustomUserImagesTEST	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    ################	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Validating connection to \\DelpoymentServer\DeployMaster$\Applications\CustomUserImagesTEST	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Mapping server share: \\DelpoymentServer\DeployMaster$	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Already connected to server DelpoymentServer as that is where this script is running from.	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    		Change directory: \\DelpoymentServer\DeployMaster$\Applications\CustomUserImagesTEST	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    		Run Command: \\DelpoymentServer\DeployMaster$\Tools\X64\bddrun.exe cscript.exe "CustomScriptTestWin10.wsff"	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    ZTI installing application 	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Event 41031 sent: ZTI installing application 	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    About to run command: \\DelpoymentServer\DeployMaster$\Tools\X64\bddrun.exe cscript.exe "CustomScriptTestWin10.wsff"	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Command has been started (process ID 4480)	ZTIApplications	10/30/2015 8:34:12 PM	0 (0x0000)
    Return code from command = 1	ZTIApplications	10/30/2015 8:34:13 PM	0 (0x0000)
    Application CustomUserImagesTEST returned an unexpected return code: 1	ZTIApplications	10/30/2015 8:34:13 PM	0 (0x0000)
    Event 41034 sent: Application CustomUserImagesTEST returned an unexpected return code: 1	ZTIApplications	10/30/2015 8:34:13 PM	0 (0x0000)
    Property InstalledApplications001 is now = {a6438b5c-b293-40e8-bff4-8ae1eac722a0}	ZTIApplications	10/30/2015 8:34:13 PM	0 (0x0000)
    ZTIApplications processing completed successfully.	ZTIApplications	10/30/2015 8:34:13 PM	0 (0x0000)
    Event 41001 sent: ZTIApplications processing completed successfully.	ZTIApplications	10/30/2015 8:34:13 PM	0 (0x0000)
    


    There's no place like 127.0.0.1

    Friday, October 30, 2015 8:52 PM
  • TYPO

    bddrun.exe cscript.exe "CustomScriptTestWin10.wsff"


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, October 30, 2015 8:58 PM
  • TYPO

    bddrun.exe cscript.exe "CustomScriptTestWin10.wsff"


    If this post is helpful please vote it as Helpful or click Mark for answer.

    No, that's my fault.  I'm sorry it's been a long week.

    I'm sanitizing the log files I'm posting, and not keeping my fake names consistent.

    The TS, App, Script, and log file match on my end.


    There's no place like 127.0.0.1

    **EDIT - I just caught the "wsff" you were pointing out.  I mistaking though you were referring to the file names I was using.

    Thanks!

    • Edited by Matt5150 Friday, October 30, 2015 9:13 PM Correction
    Friday, October 30, 2015 9:11 PM
  • Dan is kind of a hero here :)

    Logs are very important. https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Mention any customizations you have made.

    Friday, October 30, 2015 9:14 PM
  • You could go simple with a bit of logging:

    <job id="CustomUserImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to replace default user account pictures
    '// Usage: cscript CustomUserImagesWin10.wsf [/debug:true]
    '// Version: 1.0 - Initial script
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// Global constant and variable declarations
    '//---------------------------------------------------------------------------- 
    
    Option Explicit 
    
    Dim sProfile
    
    sProfile = oShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
    
    '//----------------------------------------------------------------------------
    '// End declarations
    '//---------------------------------------------------------------------------- 
    
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '// 
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '// 
    '//---------------------------------------------------------------------------
    Function ZTIProcess() 
    
    	oLogging.CreateEntry "CustomUserImagesWin10: Replacing user account pictures", LogTypeInfo	
    
    	' Replace User Account Pictures
    	oFSO.CopyFile oUtility.ScriptDir & "\*.png", sProfile & "\Microsoft\User Account Pictures\", True
    	oFSO.CopyFile oUtility.ScriptDir & "\*.bmp", sProfile & "\Microsoft\User Account Pictures\", True
    
    	oLogging.CreateEntry "CustomUserImagesWin10: Finished replacing user account pictures", LogTypeInfo	
    	
    End Function 
    
    </script>
    </job>


    If this post is helpful please vote it as Helpful or click Mark for answer.


    Same WinPE warning message.

    I'll move it to State Restore and try again.

    -Matt


    There's no place like 127.0.0.1

    As an App running in State Restore (after type correction) it seems to have run fine, but I can't find any of the log entries that should have been created.  In BDD.log, ZTIApplication.log, or CustomUserImagesWin10.log.

    Where is this supposed to be writing to?


    There's no place like 127.0.0.1

    Friday, October 30, 2015 9:37 PM
  • Hey Matt looks like I missed a few things. I tested this and it should work.

    <job id="CustomUserImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to replace default user account pictures
    '// Usage: cscript CustomUserImagesWin10.wsf [/debug:true]
    '// Version: 1.0 - Initial script
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// Global constant and variable declarations
    '//---------------------------------------------------------------------------- 
    
    Option Explicit 
    Dim iRetVal 
    
    '//----------------------------------------------------------------------------
    '// End declarations
    '//---------------------------------------------------------------------------- 
    
    '//----------------------------------------------------------------------------
    '// Main routine
    '//---------------------------------------------------------------------------- 
    
    On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    On Error Goto 0 
    
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '// 
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '// 
    '//---------------------------------------------------------------------------
    
    Function ZTIProcess() 
    
    	Dim sProfile
    	
    	sProfile = oShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
    	
    	' Replace User Account Pictures
    	oLogging.CreateEntry oUtility.ScriptName & ": Replacing user account pictures", LogTypeInfo
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\*.png", sProfile & "\Microsoft\User Account Pictures\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomUserImagesWin10: Error copying PNG files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomUserImagesWin10.log", LogTypeWarning
    	End If	
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\*.bmp", sProfile & "\Microsoft\User Account Pictures\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomUserImagesWin10: Error copying BMP files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomUserImagesWin10.log", LogTypeWarning
    	End If	
    	
    	oLogging.CreateEntry oUtility.ScriptName & ": Finished replacing user account pictures", LogTypeInfo	
    	
    End Function 
    
    </script>
    </job>

    The logging worked too.


    If this post is helpful please vote it as Helpful or click Mark for answer.


    • Edited by Dan_Vega Saturday, October 31, 2015 2:52 PM
    Saturday, October 31, 2015 2:52 PM
  • Dan is kind of a hero here :)

    Logs are very important. https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Mention any customizations you have made.


    Thanks Ty, you are too kind

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Saturday, October 31, 2015 3:04 PM
  • Hey Matt looks like I missed a few things. I tested this and it should work.


    The logging worked too.


    If this post is helpful please vote it as Helpful or click Mark for answer.


    Which log is this in?

    Thanks!

    -Matt


    There's no place like 127.0.0.1

    Monday, November 2, 2015 8:30 PM
  • It's in the code.

    "\SMSOSD\OSDLOGS\CustomUserImagesWin10.log"

    Not only will it have its own log file but it'll be logged in the BDD.log as well.


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Monday, November 2, 2015 8:41 PM
  • Hey Matt looks like I missed a few things. I tested this and it should work.

    <job id="CustomUserImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to replace default user account pictures
    '// Usage: cscript CustomUserImagesWin10.wsf [/debug:true]
    '// Version: 1.0 - Initial script
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// Global constant and variable declarations
    '//---------------------------------------------------------------------------- 
    
    Option Explicit 
    Dim iRetVal 
    
    '//----------------------------------------------------------------------------
    '// End declarations
    '//---------------------------------------------------------------------------- 
    
    '//----------------------------------------------------------------------------
    '// Main routine
    '//---------------------------------------------------------------------------- 
    
    On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    On Error Goto 0 
    
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '// 
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '// 
    '//---------------------------------------------------------------------------
    
    Function ZTIProcess() 
    
    	Dim sProfile
    	
    	sProfile = oShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
    	
    	' Replace User Account Pictures
    	oLogging.CreateEntry oUtility.ScriptName & ": Replacing user account pictures", LogTypeInfo
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\*.png", sProfile & "\Microsoft\User Account Pictures\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomUserImagesWin10: Error copying PNG files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomUserImagesWin10.log", LogTypeWarning
    	End If	
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\*.bmp", sProfile & "\Microsoft\User Account Pictures\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomUserImagesWin10: Error copying BMP files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomUserImagesWin10.log", LogTypeWarning
    	End If	
    	
    	oLogging.CreateEntry oUtility.ScriptName & ": Finished replacing user account pictures", LogTypeInfo	
    	
    End Function 
    
    </script>
    </job>

    The logging worked too.


    If this post is helpful please vote it as Helpful or click Mark for answer.


    Sorry got pulled away from this on a nasty Citrix issue.

    Ok I think I found my problem.  Did the path for the source files change?  My files are at "%SCRIPTDIR%\Win10\UserIcons\".    Is the script looking for them in the root of %SCRIPTDIR% now?


    There's no place like 127.0.0.1

    Tuesday, November 10, 2015 12:06 AM
  • If you use my script (the one you quoted) it using a relative path, just dump the picture files in the same folder as the script that was imported as an application. The absolute path would be something like \\Deploymentshare\Share\Applications\CustomImages\

    CustomImages = Whatever folder name you used when you imported the script as an application.

    Note: oUtility.ScriptDir = Imported application folder
    It does not mean the Script folder in the root of your deployment shareIf this post is helpful please vote it as Helpful or click Mark for answer.

    • Edited by Dan_Vega Tuesday, November 10, 2015 2:38 PM
    Tuesday, November 10, 2015 2:38 PM
  • Ok I apologize.  The time away from this caused me to have to take a step back and wrap my head around it again. :D

    So after moving my images to the root, it worked fine in State Restore.

    Adding some code for the sub directories and wallpaper worked, except for the permission errors when replacing the wallpaper.

    <job id="CustomImagesWin10">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to replace default user account pictures
    '// Usage: cscript CustomImagesWin10.wsf [/debug:true]
    '// Version: 1.0 - Initial script
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// Global constant and variable declarations
    '//---------------------------------------------------------------------------- 
    
    Option Explicit 
    Dim iRetVal 
    
    '//----------------------------------------------------------------------------
    '// End declarations
    '//---------------------------------------------------------------------------- 
    
    '//----------------------------------------------------------------------------
    '// Main routine
    '//---------------------------------------------------------------------------- 
    
    On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    On Error Goto 0 
    
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '// 
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '// 
    '//---------------------------------------------------------------------------
    
    Function ZTIProcess() 
    
    	Dim sProfile
    	
    	sProfile = oShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
    	
    	Dim sWindir
    	
    	sWindir = oShell.ExpandEnvironmentStrings("%WINDIR%")
    	
    	' Replace User Account Pictures
    	oLogging.CreateEntry oUtility.ScriptName & ": Replacing user account pictures", LogTypeInfo
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\CustomImg\User\*.png", sProfile & "\Microsoft\User Account Pictures\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomImagesWin10: Error copying PNG files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomImagesWin10.log", LogTypeWarning
    	End If	
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\CustomImg\User\*.bmp", sProfile & "\Microsoft\User Account Pictures\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomImagesWin10: Error copying BMP files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomImagesWin10.log", LogTypeWarning
    	End If	
    	
    	oLogging.CreateEntry oUtility.ScriptName & ": Finished replacing user account pictures", LogTypeInfo	
    
    	' Replace Wallpaper Pictures
    	oLogging.CreateEntry oUtility.ScriptName & ": Replacing wallpaper pictures", LogTypeInfo
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\CustomImg\4K\Wallpaper\Windows\*.jpg", sWindir & "\Web\4K\Wallpaper\Windows\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomImagesWin10: Error copying 4K JPG files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomImagesWin10.log", LogTypeWarning
    	End If	
    	
    	iRetVal = oFSO.CopyFile(oUtility.ScriptDir & "\CustomImg\Screen\*.bmp", sWindir & "\Web\Screen\", True)
    
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "CustomImagesWin10: Error copying Screen JPG files. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\CustomImagesWin10.log", LogTypeWarning
    	End If	
    	
    	oLogging.CreateEntry oUtility.ScriptName & ": Finished replacing wallpaper pictures", LogTypeInfo	
    End Function 
    
    </script>
    </job>

    So I get what you were saying above, that replacing the wallpaper and lock screen could be done through other methods, but I REALLY wanted to be able to do this during the Postinstall phase.

    Even if we coded to change the security of the files, this still would not work in Postinstall as an App or a script from what I can see.


    There's no place like 127.0.0.1

    Wednesday, November 11, 2015 5:36 AM
  • What do your log files say? The script I posted last with a screenshot of the logs was working just fine postinstall.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Wednesday, November 11, 2015 2:15 PM
  • If I simply move the application up in the process to Postinstall, I get this.

    Do you want me to run it as a Task CSCRIPT command instead?

    -Matt


    There's no place like 127.0.0.1

    Thursday, November 12, 2015 8:02 PM
  • Wait so are you installing it during PostInstall or while you're still in WinPE? It's imported as an application, therefore it can't be run during PE. Even if you used a run commandline to run the script, you would have to do it right after the "Install Operating System" so that the folder structure existed, but you'd have to change the variables that were being used.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, November 12, 2015 8:27 PM
  • That is exactly right.  After installation, but before the first boot.

    There's no place like 127.0.0.1

    Thursday, November 12, 2015 8:30 PM
  • If you're going to do that you have to use different variables. The variables in my script are meant to be run during PostInstall.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, November 12, 2015 8:51 PM
  • If you're going to do that you have to use different variables. The variables in my script are meant to be run during PostInstall.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Maybe I've confused the issue here, if so I apologize.

    My task is built from the standard deploy and capture task sequence.

    I'm trying to get these scripts to work here, in Postinstall (PowerShell scripts folder):


    There's no place like 127.0.0.1

    Thursday, November 12, 2015 9:48 PM
  • Sorry bad wording on my part, I meant State Restore. I don't know why I was saying Postinstall, I was probably just thinking post or after Windows is installed and the system boots into Windows. Sorry about that.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, November 13, 2015 6:23 PM