Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing computer Name
Message
 
À
10/11/2004 05:04:53
Carl Dobson
Reference Point Computers
Overbury, Tewks, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00954066
Message ID:
00960161
Vues:
8
>HOWEVER THIS DOESN'T WORK WHAT HAVE I MISSED ?


You should specify Username and Password (and it must be from some administrator) for they are not optional, if you print the error (? loCS.Rename(lcNewName)) You'll probably see the error is 2221, which is "User name could not be found"

A shorter way of doing it is:
loWMIService = GETOBJECT("winmgmts:")
loCS = loWMIService.Get("Win32_ComputerSystem.Name='" + Getenv("COMPUTERNAME") + "'")
if loCS.Rename(lcNewName, lcAdminUser, lcAdminPassword)
  ? 'You need to reboot'
endif
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform