anchor.diff:  	net start msiserver >nul 2>&1
   )
   
  -:: Prep task: check for skip patches (-sp) flag or variable and skip if used
  -if /i %SKIP_PATCHES%==yes (
  -	call functions\log.bat "%CUR_DATE% %TIME% !  SKIP_PATCHES (-sp) set. Skipping all app patches."
  -	goto skip_patches
  +:: Prep task: check for skip application patches (-sap) flag or variable and skip if used
  +if /i %SKIP_APP_PATCHES%==yes (
  +	call functions\log.bat "%CUR_DATE% %TIME% !  SKIP_APP_PATCHES (-sap) set. Skipping all app patches."
  +	goto skip_application_patches
   )
   
   
  
positive.code: :: PREP AND CHECKS ::
  :::::::::::::::::::::
  set STAGE_5_SCRIPT_VERSION=1.1.6
  set STAGE_5_SCRIPT_DATE=2017-02-04
  
  :: Check for standalone vs. Tron execution and build the environment if running in standalone mode
  if /i "%LOGFILE%"=="" (
  	pushd ..
  	
  	:: Load the settings file
  	call functions\tron_settings.bat
  
  	:: Initialize the runtime environment
  	call functions\initialize_environment.bat
  )
  	
  	
  	
  ::::::::::::::::::::
  :: STAGE 5: Patch :: // Begin jobs
  ::::::::::::::::::::
  
negative.code: )
  
  
  :: JOB: Skip point for if -sap (skip application patches) flag was used
  :skip_application_patches
  
  
  :: JOB: Windows updates
  if /i %SKIP_WINDOWS_UPDATES%==no (
  	title Tron v%TRON_VERSION% [stage_5_patch] [Windows Updates]
  	call functions\log.bat "%CUR_DATE% %TIME%    Launch job 'Install Windows updates'..."
  
  	:: Detect if bundled WSUS Offline updates are included. If so, execute those instead
  	if exist stage_5_patch\wsus_offline\client\Update.cmd (
  		if /i %SKIP_WSUS_OFFLINE%==no (
  			title Tron v%TRON_VERSION% [stage_5_patch] [WSUS Offline Updates]
  			call functions\log.bat "%CUR_DATE% %TIME% !  WSUS Offline updates detected. Using bundled update package..."
  			if /i %DRY_RUN%==no call "%WSUS_OFFLINE_CMD%" >> "%LOGPATH%\%LOGFILE%" 2>&1
  		) else (
  			call functions\log.bat "%CUR_DATE% %TIME% !  WSUS Offline updates detected, but SKIP_WSUS_OFFLINE (-swo) set."
  			call functions\log.bat "%CUR_DATE% %TIME%    Using regular online update method..."
  			if /i %DRY_RUN%==no (
  				sc config wuauserv start= demand>> "%LOGPATH%\%LOGFILE%" 2>NUL
  				net start wuauserv >> "%LOGPATH%\%LOGFILE%" 2>NUL
  				wuauclt /detectnow /updatenow >> "%LOGPATH%\%LOGFILE%" 2>NUL
  				ping 127.0.0.1 -n 15 >nul
  			)
  		)
  	)
  	call functions\log.bat "%CUR_DATE% %TIME%    Done."
  ) else (
  	call functions\log.bat "%CUR_DATE% %TIME% !  SKIP_WINDOWS_UPDATES (-swu) set. Skipping all Windows Update methods."
  )
  
  
  