$cs.Sys_Sleep
Description
Section titled “Description”Pauses script execution for the given number of seconds. The valid range is greater than 0 and less than 14400 (under 4 hours) — values outside that range are silently ignored, meaning no sleep happens at all and no error is raised.
Syntax
Section titled “Syntax”$cs.Sys_Sleep(int seconds)
Parameters
Section titled “Parameters”seconds (Integer)
Section titled “seconds (Integer)”Number of seconds to sleep. Must be greater than 0 and less than 14400.
Return value
Section titled “Return value”None.
Example
Section titled “Example”Wait for a background process to settle before continuing:
$cs.Job_WriteLog("Waiting 60 seconds for background process to settle")$cs.Sys_Sleep(60)Give a service a short grace period after restarting it before the next installer step depends on it being ready:
$cs.Service_Stop("MyAppService")$cs.Service_Start("MyAppService")$cs.Job_WriteLog("Waiting 15 seconds for MyAppService to finish initializing")$cs.Sys_Sleep(15)Insert a brief pause between two dependent installer steps, such as after registering a component before configuring it:
$cs.Job_WriteLog("Registering component, waiting briefly before configuration step")Start-Process "regsvr32.exe" -ArgumentList "/s `"$global:Packageroot\mycomponent.dll`"" -Wait$cs.Sys_Sleep(5)