Set the fullname property of a user account
This example shows setting the fullname property for a user account. Other properties can be set in a similar way
/**
* Script: setFullName.js
* Purpose: Set the FullName property for an account.
* Author: Daren Thiel
* Date: 25 Mar 2001
* Web: http://www.winscripter.com
**/
// Set the FullName Property for 'suser' on 'ComputerA' to 'Some A. User'
WScript.Echo( setFullName( "ComputerA", "suser", "Some A. User" ) );
/**
* setFullName - Sets the FullName Property for an account
* returns string with status information.
*
* example - var rst = setFullName( "DOMAIN", "someuser", "FirstName LastName" );
* - var rst = setFullName( "DOMAIN/Computer", "someuser", "FirstName LastName" );
**/
function setFullName( domain, user, fullname )
{
try
{
var m_user = GetObject( "WinNT://" + domain + "/" + user + ",user" );
m_user.FullName = String( fullname );
m_user.SetInfo()
return( "Set FullName to: " + fullname );
}
catch( e )
{
return( "Error: " + e.description );
}
}