Skip to content

feat: add govc vm.customize command to support password and custom script#3867

Merged
tenthirtyam merged 1 commit intovmware:mainfrom
xiaofengw1205:feature/support-pwd-custom-script-in-customize
Oct 13, 2025
Merged

feat: add govc vm.customize command to support password and custom script#3867
tenthirtyam merged 1 commit intovmware:mainfrom
xiaofengw1205:feature/support-pwd-custom-script-in-customize

Conversation

@xiaofengw1205
Copy link
Copy Markdown
Contributor

@xiaofengw1205 xiaofengw1205 commented Sep 18, 2025

Description

This change enhances the govc vm.customize command by adding support for:

  • -pwd: Change the password of the default administrator (Administrator for Windows, root for Linux).
  • -expire-pwd: Expire the password of the default administrator, requiring users to set a new password at the next login.
  • -script-file: Specify a script to be executed before and after the customization process.

How Has This Been Tested?

Deployed a vCenter with both Windows and Linux VMs, then ran:

govc vm.customize -vm rhel -name rhel -ip dhcp \
          -pwd 'NewPwd@123' -expire-pwd -script-file './test.sh'

and

govc vm.customize -type Windows -vm win10 -name win10 -ip dhcp \
          -pwd 'NewPwd@123' -expire-pwd -script-file '~/test.bat' \
          -username fake -org dummy

Power on the VM and wait for customization complete, verify below:

  • Customization completed successfully
  • Administrator/root password was updated
  • Password expiration enforced (required reset before login)
  • Custom script executed successfully

feat

#3888

@xiaofengw1205 xiaofengw1205 force-pushed the feature/support-pwd-custom-script-in-customize branch from eeac718 to 026d750 Compare September 18, 2025 08:10
@xiaofengw1205 xiaofengw1205 marked this pull request as draft September 18, 2025 08:11
@xiaofengw1205 xiaofengw1205 marked this pull request as ready for review September 18, 2025 08:18
@xiaofengw1205
Copy link
Copy Markdown
Contributor Author

@akutz Please help to review this PR, this is to support changing password/expiring password and run custom script in govc. Thanks.

@xiaofengw1205 xiaofengw1205 changed the title Eenhances the govc vm.customize command to support password and custom script Enhances the govc vm.customize command to support password and custom script Sep 23, 2025
@xiaofengw1205
Copy link
Copy Markdown
Contributor Author

ping @akutz, please help to review, thanks.

@tenthirtyam
Copy link
Copy Markdown
Contributor

Looks like the CI is failing and that make docs needs to be run and committed.

Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run make docs.

@xiaofengw1205 xiaofengw1205 force-pushed the feature/support-pwd-custom-script-in-customize branch from 6b44975 to b1bb311 Compare September 29, 2025 02:54
@xiaofengw1205
Copy link
Copy Markdown
Contributor Author

Looks like the CI is failing and that make docs needs to be run and committed.

Thanks for the review, update the doc and PTAL.

Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to clarify as "VCF Automation" where applicable and to correct the spelling of "signature", too.

@tenthirtyam tenthirtyam changed the title Enhances the govc vm.customize command to support password and custom script feat: add govc vm.customize command to support password and custom script Sep 30, 2025
Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes requested.

Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open an issue and link the issue to this pull request for traceability?

@tenthirtyam tenthirtyam marked this pull request as draft October 6, 2025 13:35
@tenthirtyam tenthirtyam changed the title feat: add govc vm.customize command to support password and custom script [wip] feat: add govc vm.customize command to support password and custom script Oct 6, 2025
@xiaofengw1205
Copy link
Copy Markdown
Contributor Author

Can you open an issue and link the issue to this pull request for traceability?

Thanks, I create an issue: #3888 and add it into this pull request, PTAL. Thanks.

@xiaofengw1205 xiaofengw1205 marked this pull request as ready for review October 10, 2025 09:08
@xiaofengw1205
Copy link
Copy Markdown
Contributor Author

@tenthirtyam, Sorry to address your comments late since I was on vacation. PTAL, thanks for your time.

@tenthirtyam tenthirtyam changed the title [wip] feat: add govc vm.customize command to support password and custom script feat: add govc vm.customize command to support password and custom script Oct 13, 2025
@tenthirtyam tenthirtyam force-pushed the feature/support-pwd-custom-script-in-customize branch 6 times, most recently from 5ec888f to 117acc8 Compare October 13, 2025 20:22
…script

This change enhances the `govc vm.customize` command by adding support for:

- **`-pwd`**: Change the password of the default administrator (`Administrator` for Windows, `root` for Linux).
- **`-expire-pwd`**: Expire the password of the default administrator, requiring users to set a new password at the next login.
- **`-script-file`**: Specify a script to be executed before and after the customization process.

Signed-off-by: Xiaofeng Wang <xiaofengw@vmware.com>
@tenthirtyam tenthirtyam force-pushed the feature/support-pwd-custom-script-in-customize branch from 117acc8 to 71b16a3 Compare October 13, 2025 20:29
@tenthirtyam tenthirtyam merged commit 12f335c into vmware:main Oct 13, 2025
11 checks passed
@xiaofengw1205 xiaofengw1205 deleted the feature/support-pwd-custom-script-in-customize branch October 14, 2025 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants