|
-
September 11th, 2006, 11:02 AM
#1
Renaming the Administrator Account, programatically, in win 2k, no AD
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-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|