0

I'm developing a small tool that is going to be distributed via executable. The first time it is executed I want a tutorial to be displayed. As users are supposed to copy/paste the tool to theirs coworkers it would be nice if I detect that the machine has been changed and display the tutorial again for the new user.

If I could identify the machine ID somehow I could store it (as a setting for example) and compare it at startup in order to display or not the tutorial.

Is there a way to identify somehow the current machine?

Sturm
  • 3,968
  • 10
  • 48
  • 78
  • Are you able to create an installer? would be much easier and less error prone (what if a user wants to copy to a second computer?) – Sayse Jan 23 '15 at 07:54
  • This question seems quite similar in essence to this one: http://stackoverflow.com/questions/1768198/how-do-i-get-the-computer-name-in-net – Thomas Jan 23 '15 at 07:55
  • The enviroment of the deployment is supossed to have restricted rights. Being portable is a feature in order to avoid call the IT guy to log as admin and install it. – Sturm Jan 23 '15 at 07:56

2 Answers2

2

Have a look at LocalStorage - which basically stores information per user. Write a small file on startup und check for it every time. If it's there, you know the user otherwise he is new.

Christian Sauer
  • 10,351
  • 10
  • 53
  • 85
0

The Process Class has a property which indicates the machine name.

Process.GetCurrentProcess().MachineName

Edit

Or get the machine name from System.Environment.MachineName

(thanks to Andreas Niedermair for mentioning it)

Chrisi
  • 371
  • 3
  • 15
  • 1
    Isn't this the same as `Environment.MachineName`? How would you ensure that the `MachinName` is unique? What do you do when the user changes the name via the system-settings? –  Jan 23 '15 at 07:59
  • Not sure what is going wrong but I'm getting a dumb '.' (a simple point) from that property. But it works using `System.Environment.MachineName` – Sturm Jan 23 '15 at 08:05
  • @AndreasNiedermair If I needed to identify a unique machine, I'd get its MAC address, but he simply wanted to get the machine name. Maybe someone has to replace their machine. In this case, it could be unwanted to display the tutorial again. – Chrisi Jan 23 '15 at 08:16
  • @Chrisi It all depends on the definition of "machine change": What if the network card, disk, windows-setup, ... gets replaced. Is it still the same machine? full ack! –  Jan 23 '15 at 10:55