PDA

View Full Version : get IP name or workstation ID



papou
09-23-2012, 06:14 AM
Hello,
Any way to get personal information from a workstation? Like machine name or IP?
I'm using 2 bat files for that but i would like a more elegant way.
Thnx

xchrisx
09-23-2012, 08:55 AM
Give this a shot, it works on windows 7. It saves out a temp file with the data, if it exists, it reads it and prints it with the StatusMsg command. Then it deletes the temp file when its done.
-chris



@warnings
@version 2.2
@script generic
@name gethostname

generic
{
tempdir = getdir(TEMPDIR);
file = tempdir + getsep() + "_hostname.tmp";
cmd = "hostname.exe > " + file;
host = systemex(cmd);

foundTempFile= matchfiles(tempdir , "_hostname.tmp");
if(foundTempFile)
{
f = File(file,"r") || error("Cannot open file",file);
StatusMsg(f.read());
f.close();

cmd = "DEL " + file;
systemex(cmd);
}
}

papou
09-23-2012, 04:52 PM
cool. I will try this.