Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







Get the full name of a user

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

Simple function to demonstrate how to retrieve a property from a user account.
/**
 *    Script:   getFullName.js
 *    Purpose:  Returns the Full Name property of a user account.
 *    Author:   Daren Thiel 
 *    Date:     25 Mar 2001 
 *    Web:      http://www.winscripter.com
 **/

// Print out the full name property for "someuser" account on "ComputerA"
WScript.Echo( getFullName( "ComputerA", "someuser" ) );

/** 
 * getFullName  - Returns the Full Name property for a user
 * 
 * example      - var fn = getFullName( "DOMAIN", "someuser" );
 *              - var fn = getLFullName( "DOMAIN/Computer", "someuser" );
 **/
 
function getFullName( domain, user )
{
    try
    {
        var m_user = GetObject( "WinNT://" + domain + "/" + user + ",user" );
        return( m_user.FullName );
    }
    catch( e )
    {
        return( "Error: " + e.description );
    }
}




Add Your Comment



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