Hi all,

I'm trying to rename the administrator account in win2k, with no active directory... programaticaly.

basicaly they want an appp that does a bunch of stuff to bring computers up to snuff, security wise...

I got it working in xp thusly...

{
string AccountName = GetAdministratorAccountName();
string newNameForAccount = "Administrator";

ManagementObject theInstance = new ManagementObject( "root\\CIMv2", "Win32_UserAccount.Domain='" + Environment.MachineName + "',Name='" + AccountName + "'", null );

ManagementBaseObject inputParams = theInstance.GetMethodParameters( "Rename" );

inputParams.SetPropertyValue( "Name", newNameForAccount );

ManagementBaseObject outParams = theInstance.InvokeMethod( "Rename", inputParams, null );
}

but it does not work on win2k machines... I've followed several leads.. but no joy...


Can anyone point me towards a mechanism that will allow me to rename the administrator account on Win2k machines using c#?

Thanks,

Eric-