How to change targets' user names and passwords

Document created by yuvals on Oct 24, 2014Last modified by fran.schwarzmann on Aug 15, 2016
Version 2Show Document
  • View in full screen mode

In large environments with many configured targets, it may be a tedious job to change the passwords for all targets. This is a major problem for Hyper-V targets where each physical host is itself a target.

 

The chpass.py script is a python script that allows you to instantly change user names and passwords for multiple target.

 

You can run it from a command line of any box that has python installed.

 

The script accepts the following command line arguments:

 

chpass.py -s <appliance server name or address> -u <admin user> [-t <Target Type>] [-d <domain name for Hyper-v>] [-f (no confirmation mode)] [<host name regex>]

 

Where:

<appliance server name or address> is the name or IP address of the vmturbo appliance.

<admin user> is the name of vmturbo admin user

<Target Type> is the type of the target to change password for. If not specified then it will try to change password for all targets.

<domain name for Hyper-v> is the domain name configured for Hyper-V targets.

<host name regex> is an optional regular expression for target names to change password for.

If the –f option is specified, the script will not ask for verification of each target and will immediately try to change the password for it.

 

After running the script, it will prompt for the admin user password and then for the user name and password to change.

Note that you will need to run the script for every user name and password that you wish to change.

 

Here are a few usage example:

 

1)  Change the password to Hyper-V targets by choosing the targets to change interactively:

 

chpass.py -s 10.33.9.150 -u administrator -t Hyper-V -d sedemo.vmturbo.com

Enter password for administrator:

Enter user name:sedemo\yuval

Enter new password for sedemo\yuval:

Change password for Hyper-V - Hyper-V4.sedemo.vmturbo.com?[Y|N]y

Successfuly changed password for Hyper-V4.sedemo.vmturbo.com

Change password for Hyper-V - HYPER-V3.sedemo.vmturbo.com?[Y|N]n

Change password for Hyper-V - hyper-v1.sedemo.vmturbo.com?[Y|N]n

Change password for Hyper-V - hyper-v2.sedemo.vmturbo.com?[Y|N]y

Successfuly changed password for hyper-v2.sedemo.vmturbo.com

 

2) Change the password to Hyper-V targets without a confirmation (-f option):

 

python chpass.py -s 10.33.9.150 -u administrator  -t Hyper-V -d sedemo.vmturbo.com -f

Enter password for administrator:

Enter user name:sedemo\yuval

Enter new password for sedemo\yuval:

Successfuly changed password for Hyper-V4.sedemo.vmturbo.com

Successfuly changed password for HYPER-V3.sedemo.vmturbo.com

Successfuly changed password for hyper-v1.sedemo.vmturbo.com

 

Successfuly changed password for hyper-v2.sedemo.vmturbo.com

 

3) Change the password to  targets that match the specified regex (in this case, targets that begin with case sensitive ‘hyper'):

 

python chpass.py -s 10.33.9.150 -u administrator -d sedemo.vmturbo.com -f ^hyper

Enter password for administrator:

Enter user name:sedemo\yuval

Enter new password for sedemo\yuval:

Successfuly changed password for hyper-v1.sedemo.vmturbo.com

 

Successfuly changed password for hyper-v2.sedemo.vmturbo.com

Attachments

Outcomes