diff --git a/.web-docs/components/builder/vsphere-clone/README.md b/.web-docs/components/builder/vsphere-clone/README.md index bae7a5dc..a9fb2f43 100644 --- a/.web-docs/components/builder/vsphere-clone/README.md +++ b/.web-docs/components/builder/vsphere-clone/README.md @@ -458,7 +458,7 @@ Example of usage: -- `run_once_command_list` (\*[]string) - Specifies a list of commands to run at first logon after the guest operating system is customized. +- `run_once_command_list` ([]string) - Specifies a list of commands to run at first logon after the guest operating system is customized. - `auto_logon` (\*bool) - Specifies whether the guest operating system automatically logs on as Administrator. diff --git a/builder/vsphere/clone/step_customize.go b/builder/vsphere/clone/step_customize.go index 243035a0..0c53eb42 100644 --- a/builder/vsphere/clone/step_customize.go +++ b/builder/vsphere/clone/step_customize.go @@ -82,7 +82,7 @@ type LinuxOptions struct { type WindowsOptions struct { // Specifies a list of commands to run at first logon after the guest operating system is customized. - RunOnceCommandList *[]string `mapstructure:"run_once_command_list"` + RunOnceCommandList []string `mapstructure:"run_once_command_list"` // Specifies whether the guest operating system automatically logs on as Administrator. AutoLogon *bool `mapstructure:"auto_logon"` // Specifies how many times the guest operating system should auto-logon the Administrator account when `auto_logon` is set to `true`. Default:s to `1`. @@ -389,11 +389,14 @@ func (w *WindowsOptions) sysprep() *types.CustomizationSysprep { } func (w *WindowsOptions) guiRunOnce() *types.CustomizationGuiRunOnce { - if w.RunOnceCommandList == nil || len(*w.RunOnceCommandList) < 1 { - return nil + if w.RunOnceCommandList == nil || len(w.RunOnceCommandList) == 0 { + return &types.CustomizationGuiRunOnce{ + CommandList: []string{""}, + } } + return &types.CustomizationGuiRunOnce{ - CommandList: *w.RunOnceCommandList, + CommandList: w.RunOnceCommandList, } } diff --git a/docs-partials/builder/vsphere/clone/WindowsOptions-not-required.mdx b/docs-partials/builder/vsphere/clone/WindowsOptions-not-required.mdx index 7dbf6d1a..87c9b299 100644 --- a/docs-partials/builder/vsphere/clone/WindowsOptions-not-required.mdx +++ b/docs-partials/builder/vsphere/clone/WindowsOptions-not-required.mdx @@ -1,6 +1,6 @@ -- `run_once_command_list` (\*[]string) - Specifies a list of commands to run at first logon after the guest operating system is customized. +- `run_once_command_list` ([]string) - Specifies a list of commands to run at first logon after the guest operating system is customized. - `auto_logon` (\*bool) - Specifies whether the guest operating system automatically logs on as Administrator.