Open hc-github-team-packer opened 3 years ago
This confuses me. Both windows-startup-script-ps1 and windows-startup-script-cmd are VM custom metadata. When packer creates the VM, you can assign any metadata that you want. Why wouldn't windows-startup-script-ps1 already work?
@SwampDragons,
Any news about this?
I can comment on this. I can confirm windows-startup-script-ps1 does work, as I am already using this successfully. I just reference it in a local file and not inline.
I just use the following block (In HCL) and this works just fine. Whether it is by accident or design I am not sure.
metadata_files = { "winows-startup-script-ps1" = "file_path" } I am happy to provide evidence/logs if needed.
I can comment on this. I can confirm windows-startup-script-ps1 does work, as I am already using this successfully. I just reference it in a local file and not inline.
I just use the following block (In HCL) and this works just fine. Whether it is by accident or design I am not sure.
metadata_files = { "winows-startup-script-ps1" = "file_path" } I am happy to provide evidence/logs if needed.
metadata_files = {
"sysprep-specialize-script-ps1" = "${path.root}/boot.ps1"
}
I have this issue
2023/11/30 13:25:35 GCEMetadataScripts: Found sysprep-specialize-script-ps1 in metadata.
2023/11/30 13:25:35 GCEMetadataScripts: sysprep-specialize-script-ps1: 'b' is not recognized as an internal or external command,
2023/11/30 13:25:35 GCEMetadataScripts: sysprep-specialize-script-ps1: operable program or batch file.
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1: There is no such global user or group: packer_user.
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1:
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1: More help is available by typing NET HELPMSG 3783.
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1:
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1: ERROR:
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1: Description = Invalid query
2023/11/30 13:25:36 GCEMetadataScripts: sysprep-specialize-script-ps1 exit status 0
2023/11/30 13:25:36 GCEMetadataScripts: Finished running specialize scripts.
boot.ps1
cmd.exe /c net user /add packer "*****"
cmd.exe /c net localgroup administrators packer /add
cmd.exe /c wmic UserAccount where Name="packer" set PasswordExpires=False
This issue was originally opened by @lmayorga1980 in https://github.com/hashicorp/packer/issues/10342 and has been migrated to this repository. The original issue description is below.
Description
According to https://www.packer.io/docs/builders/googlecompute.html#windows, is only possible to use the
windows-startup-script-cmd
when using GCP as the builder. Would it be possible to use an existing powershell script?Use Case(s)
Powershell script uses a combination of
cmdlets
andnative windows
executables.Potential configuration