I've spent more hours on this, and I think a cleaner way to change the
password of the administrator account is by using the command:
net user administrator 'password'
but I'm having trouble with getting this command to work. I think the
problem is with the 'vm_shell' value, as I'm not sure which shell to use.
Thoughts?
Thanks
tl
On Wednesday, June 21, 2023 at 8:37:50 AM UTC-4 Terry Lemons wrote:
> Hi - my team has an Ansible automation that deploys and configures a new
> Windows Server system in our vSphere-based lab environment. It uses govc to
> deploy an .ova created within our company that has a secure password for
> the 'administrator' account, and the 'administrator' account is set to
> force a password change on first login. I want to automate the password
> change in our Ansible workflow. After ova deployment, the network settings
> have not yet been applied.
>
> I've tried using the vmware_vm_shell module with these values:
>
> - name: "Set new administrator account password"
> local_action:
> module: vmware_vm_shell
> hostname: "{{ management_vcenter_ip }}"
> username: "{{ management_vcenter_user }}"
> password: "{{ management_vcenter_password }}"
> validate_certs: False
> datacenter: "{{ datacenter }}"
> vm_id: "{{ vm_name }}"
> vm_username: "{{ vm_admin }}"
> vm_password: "{{ vm_password }}"
> vm_shell:
> "C:\\Windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe"
> vm_shell_args: " -command Set-LocalUser -Name administrator -Password
> {{vm_new_password}}"
> vm_shell_cwd: "C:\\Windows\\Temp"
>
> but am seeing this unhelpful response:
>
> TASK [deploy-windowssql : Set new administrator account password]
> ***************************************************************************************************************************
> fatal: [ldpdd192.hop.lab.emc.com -> localhost]: FAILED! => {"changed":
> false, "msg": "A general system error occurred: vix error codes = (1,
> 0).\n"}
>
> Am I using vmware_vm_shell or the Powershell Set-LocalUser command
> incorrectly? Or is there a better way to change the 'administrator'
> password on a VM that is running but is not yet network-accessible?
>
> Thanks!
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/48220a53-7cda-4104-9314-3dc9c0de9f9dn%40googlegroups.com.