Hello. I have a tool that does some migration task when a user moves a Windows 7 machine from one location to another. One task is to give the local administrator account a new password based on what is used at the site. This works well except for sites that use the French language pack. Administrator is spelled administrateur.
I want to have the tool check how admin account is spelled. Based on what it finds, it will execute the proper code to set the admin password. I was trying to use environment.username but discovered that is for the logged on user only. Is there a way to check the spelling of the admin account using vb.net?
Thank you for any help.
If Environment.UserName = "administrateur" Then
Dim user As System.DirectoryServices.DirectoryEntry
user = New System.DirectoryServices.DirectoryEntry("WinNT://" + Environment.MachineName + "/administrateur,user")
Catch ex As Exception
MsgBox("Error " + Err.Number.ToString + ". Failed to set local Administrateur password.", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Windows 7 Migration Tool")
Me.Cursor = Cursors.Default