Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







Set the full name property of a user

Posted by on Friday, January 16, 2004 (PST)

Simple example of how to set a property of a user account.

 

/**
 *    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 );
    }
}















WSH and ADSI Administrative Scripting

New Articles
  • List installed COM objects and associated ProgIDs
    Script: Lists all COM Objects and their associated ProgIDs (If available). Win32_ClassicCOMClassSetting

  • Script: File Rotator
    Script: Rotate files where the most current file has the lowest number in the archive. When files exceed the retention period, they are deleted. Typically used for log files, backups, etc..

  • Script: Create IIS Website and DNS record
    Script: Dan Casier sent me this script that will create a website and appropriate DNS record. The script is intended for Windows 2000 Server with local DNS and necessary DNS mof installed.


  • Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon