Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing computer Name
Message
 
To
24/10/2004 06:47:02
Carl Dobson
Reference Point Computers
Overbury, Tewks, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00954066
Message ID:
00954074
Views:
18
to retreve the computer name

How about this?
? GETENV("COMPUTERNAME")
Or this (requires Windows Scripting and I cannot test it in '95)
lcComputer = "."
loWMIService = GetObject("winmgmts:" ;
+ "{impersonationLevel=impersonate}!\\" + lcComputer + "\root\cimv2")
colComputers = loWMIService.ExecQuery ;
("Select * from Win32_ComputerSystem")
For Each loComputer in colComputers
   MESSAGEBOX('Computer Name:' +loComputer.Name)
Next
And to rename
lcComputer = "."
loWMIService = GetObject("winmgmts:" ;
+ "{impersonationLevel=impersonate}!\\" + lcComputer + "\root\cimv2")
colComputers = loWMIService.ExecQuery ;
("Select * from Win32_ComputerSystem")
For Each loComputer in colComputers
   loComputer.Rename("Computer 2")
Next
>is there another way other than that stated in "RE: Ipconfig? Ipaddress, subnet & Def' Gateway" to retreve the computer name and again how would I change it without asking my customers to right click on "My Computer", "Computer name" etc etc I also needed it to apply to windows 95, 98, ME, 2K and XP.... Any ideas any one ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform