Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identifying a machine
Message
From
17/12/2010 16:10:08
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01492926
Message ID:
01493159
Views:
69
No - you don't have to set up an environment variable in CONFIG.SYS or elsewhere. Just use SYS( 0 ) in VFP and parse out the portion before the "#".

In fact, using an environment variable is a bad idea because it does NOT have to be distinct between computers. IOW two computers could have an environment variable "MyComputerName" set to the same value. And as for security, yes it's way easier for someone to change an environment variable than to change the machine's NetBIOS name.
lcComputerName = GetComputerName()

FUNCTION GetComputerName

RETURN ;
  LEFT( SYS( 0 ), AT( "#", SYS( 0 ) ) - 2 )
>So the top & bottom of this is:
>
>The easiest way to impliment this would be to put a variable into the config.sys to identify the machine, not very secure though?
>
>OR: If you are lucky enough that the customers dont have complication spec IE only one network card in each machine,
>
>Will have to discuss with customer, but my guess is they'll say 1st way is fine :)
>
>
>>Yes, a user with local admin privileges can change the machine's NetBIOS name. In practice, though, that's a PITA. If it's part of a domain, and it's not done by a domain admin there will be problems with the machine account on the domain controller. Even if it's just networked peer-to-peer you can potentially have problems like invalid security lists (who can access folder shares, printers etc.), loss of profile information if the old profile isn't migrated to a new name (with loss of e-mail, IE favourites and lots of other stuff that gets stored in a profile) etc.
>>
>>Long story short, changing the machine name can cause a lot of problems so it's highly recommended to never do it. So, when you combine that with the requirement that each machine on a local network must have a unique NetBIOS name, it's a pretty good way to individually track machines.
>>
>>BTW the unique requirement means that someone can't change a machine name from CANNING to WEIGHTING to try to get WEIGHTING's privileges, because the latter name is already being used on the network.
>>
>>>Would it then be possible for an ordinary user to change the machine name & ulimately change the access of the machine?
>>>
>>>I presume if the logged on use doesnt Administrator rights they cant change the computer name?
>>>
>>>>
>>>>>Someone already pointed out that the first part of SYS( 0 ) returns the machine (NetBIOS) name.
>>>>>
>>>>>>Thanks for that, I was hoping to just pick a machine name or whatever, it needs to be guided by the actual physical machine IE one machine in CANNING is able to CAN TAB, a mching in weighing is able to amend WEIGHTING TAB.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform