On Windows there are a number of ways you can do this through the Send Event script step but the big issue is that you can not return a result directly like with AppleScript.
Using the machine name is probably not a good idea though because it is very easy to change.
Understood, but this particular client is insistent, and they would be able to manage the machine name as well in their settings layout. I'm just looking for a method they can manage rather than hardcode something that would break, where based on the computer they're using, different system settings would be in effect - window size, placement, zoom level, etc..
Do you have any examples on the Send Event script you could share?
There is a name and there is an account (permissions/access).
The Name is typically the name of the computer, Account is what is used for login. These can be the same, but I avoid that. If you capture these values you can branch in any script. You can also have:
Get (PersistentID) and Get (SystemNICAddress)
Research these in your Functions Reference (also in Help). Note what gets captured and when.
-- sent from my iPhone4 --
I'm just looking for a method they can manage rather than hardcode
How does this work? How would they manage it vs. checking for hard-coded machine names? They could store machine names with accounts in a user table but since the user could change their machine name at will, that would be pointless.
(unless of course machine settings are governed by some Windows group policy enforced by a domain controller).
I hear ya that the client insists but you have to document the objections/pitfalls.
As to how to do it: what versions of Windows does need to work on? (Think now and in future upgrades!)
Christian Schmitz wrote:
Do you use our MBS Plugin?
I love your plugin, Christian, but this is not the point. If the functionality of the solution depends on knowning the computer name BUT the control of changing that computer name is in the user's hands then that control mechanism is pointless.
I would go with the NIC address or similar, as suggested by Beverly. And as already pointed out by others, if the user can easily change the name of the computer then there is no point in trying to rely on that; on the other hand you should be able to readily establish o more robust ID for each machine.
Just like to add that I recently used NIC to identify a unique user and then later discovered that the user has multiple user login accounts on their computer (I smacked my hand against my forehead) - I honestly did not consider this. 1 computer can have multiple users, but alas, they will have the same NIC!
With the appropriate trapping for machines that have multiple NIC addresses, of course. :)
the functions in our plugin can also return Windows Product Key and Mac's serial number.
and some more values which can help to identify the computer.