This is the first in a series of tips that will outline how to use VShell to automate common administrative tasks.
This tip will describe how to change the local administrator password without having to physically go to every machine. VShell must be installed on all machines on which the password is to be changed.
Fortunately, the Windows command line allows you to perform almost all of the Windows tasks that you need to administer the system. The syntax in most cases is straightforward and easy to learn, and remote command-line administration is much more efficient than Remote Desktop because only a few bytes are transmitted and the process can be automated for multiple machines.
The Windows command shell is a powerful environment and contains a strong complement of Win32 console utilities to support it, including "net config" and "net user". Many of the Windows integrated administrative facilities are grouped under the "net" command. Typing "net" at the command line will print out a list of these commands. Details about the use of any "net" command are available by typing:
net <command> /?
Changing the local administrator's password can be accomplished by executing the following command on each system:
net user <username> <new_password>
The command will be launched using the remote execute capability of an SSH2 connection made to each target machine's VShell service.
Running the remote command can be accomplished in a number of ways, depending on the SSH client you are using. For example, VanDyke Software's vsh utility can be used to execute the change password operation by adding the command after the login/host information:
vsh -pw P4$$w0rd firstname.lastname@example.org "net user local-admin N3wPa$$w0rD"
Another way to run the remote command would be to use VanDyke Software's VRALib COM interface. The VRALib API allows scripting of SSH2 connections and provides remote execution through the "Connection" and "Exec" objects. For example, the sequence of PowerShell commands use the VRALib COM API to perform a password change operation on a remote machine:
PS> $connection = New-Object -com vralib.connection
PS> $connection.Hostname = "192.168.232.163"
PS> $connection.Username = "local-admin"
PS> $connection.Password = 'P4$$w0rd'
PS> $connection.AutoAcceptHostKey = 1
PS> $exec = $connection.Exec('net user local-admin N3wP4$$w0rd')
The command completed successfully.
Please see the VShell or ClientPack help files for more information about using VRALib.
Here you can control cookies using the checkboxes below. Some cookies are essential for the use of our website and cannot be disabled. Others provide a convenience to the user and, if disabled, may reduce the ease of use of our site. Finally, some cookies provide anonymous analytic tracking data that help us provide the user with a richer browsing experience. You can elect to disable these cookies as well.