With Windows, similar to Linux, some OS adaptation scripts are provided by Velostrata as default; additional ones can be added by users. 

User scripts are placed here: “c:\Program Files\Velostrata\UserScripts”

The registry is updated to run the scripts (“UserTasks”) on startup depending on the environment the VM is running at, referred to as MachineState. The three options are: 

  • Origin  on premises environment
  • Velostrata - the scripts will run when the VM is running in cached mode 
  • Detach - the scripts will run after the detach operation 

The tasks are executed sequentially in alphabetic order. If the order of the tasks matter, it is recommended to use numerical prefixes to task names, e.g. “10_ResetWMI” and “20_ConfigKMS”. 

When writing the user script, absolute paths should be used as the script is copied to the UserScripts folder, which can cause relative paths to break.

In order for the tasks to be properly configured, scripts should be placed in the appropriate folder and the registry should be updated. The following section describes how this can be easily done using an assistance script.  Note that only PowerShell scripts can be used for this purpose. 

Powershell Assistance Script

Velostrata provides a PowerShell module that enables easy installation of a user script on a relevant VM. The script validates user input to prevent inconsistent states, copies the user script to the UserScripts directory, and creates its tree if it’s missing. It also creates the relevant registry keys and their trees, and fills in the appropriate values.

Module name: VelostrataUserScripts.psm1

Available commands are Install-VelosUserScript and Remove-VelosUserScript.

How to use the assistance script:

  1. Download the module from Velostrata S3 repository:

  1. Import the module (make sure to use relevant path): 

       Import-Module .\VelostrataUserScripts.psm1 -force

  1. Run the assistance script per each OS adaptation script/task you wish to configure. 


Install-VelosUserScript -FilePath .\resetWMI.ps1 -TaskName “10_ResetWMI”

 -MachineState Detach -TaskType RunAlways -Platform Aws


  • FilePath: The file name. Note that files run from the path of the user-scripts folder. 
  • TaskName: A unique name to be provided by the user. See note about sequencing above.
  • MachineState: One of the following three options: 
    • Origin - on-premises environment.
    • Velostrata - the scripts will run when the VM is running in cache mode. 
    • Detach - the scripts will run after the detach operation.
  • TaskType: one of two options: 
    • RunOnce - This means the task will run once on the next boot and is then deleted,
    • RunAlways - The task will run on every boot.
  • Platform: represents the environment in which the VM is running. May be either:
    • Aws
    • Azure
    • All

Note that the Platform parameter is optional and defaults to All.

  1. The script removal command validates that a task exists and then deletes it from the registry, and optionally also for the scripts directory. 


Remove-VelosUserScript -TaskName “ResetWMI” -MachineState Detach -DeleteScriptFile


TaskName  - should be similar to the one provided during scriptInstall

DeleteScriptFile  an optional parameter


Install-VelosUserScript -FilePath .\KMS\Config-Kms_AWS.ps1 -TaskName “10_configKMS” -MachineState Velostrata -TaskType RunAlways

Remove-VelosUserScript -TaskName "10_configKMS" -MachineState Velostrata -DeleteScriptFile