10 Replies Latest reply on Mar 2, 2014 4:05 AM by monkeybreadsoftware

    Detect computer name


      Does anyone have a good method of detecting the computer name? I'm looking for a way to change settings based on a computer name, such that when a user moves from their desktop to their laptop, the settings adjust accordingly.


      I've done some investigating and made a few attempts, but I'm hoping that someone in the community has figured this out. Finding file paths, desktop path, etc., provide everything but the computer name. It looks like AppleScript might work for Macs, but I'm not sure if something similar would work for Windows.


      Any answers or suggestions would be greatly appreciated.



        • 1. Re: Detect computer name

          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.

          • 2. Re: Detect computer name

            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?




            • 3. Re: Detect computer name

              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 --

              Beverly Voth


              • 4. Re: Detect computer name

                techt wrote:


                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!)

                • 5. Re: Detect computer name

                  Do you use our MBS Plugin?

                  If yes, you could use the SystemInfo.ComputerName function.




                  • 6. Re: Detect computer name

                    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.

                    • 7. Re: Detect computer name

                      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.

                      • 8. Re: Detect computer name

                        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!

                        • 9. Re: Detect computer name

                          With the appropriate trapping for machines that have multiple NIC addresses, of course.  :)

                          • 10. Re: Detect computer name

                            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.