Computer ID

sabzamsabzam Member Posts: 1,149
Dear All,

Is it possible to get a computer id or something similar. What I need is to get a function similar to UserID; to identify from which computer did the entry get posted/created.

Did anyone ever use something similar.

Comments

  • DenSterDenSter Member Posts: 8,305
    Check out the 'Host Name' field in the Session table.
  • SavatageSavatage Member Posts: 7,142
    We use this get a bunch of info on 3.7 & native database:
    from computer name, Ip address, database name & server name....
    IF ISCLEAR(WSHShell) THEN 
      CREATE(WSHShell); 
    
    WSHExec := WSHShell.Exec('nslookup ' + ENVIRON('computername'));
    WSHTxt := WSHExec.StdOut;
    WSHTxt.SkipLine;
    WSHTxt.SkipLine;
    WSHTxt.SkipLine;
    ComputerName := COPYSTR(WSHTxt.ReadLine,1,80);
    ComputerIP := COPYSTR(WSHTxt.ReadLine,10,80);
    CLEAR(WSHShell); 
    ComputerName:= (ENVIRON('computername'));
    
    MyContext := CONTEXTURL;
    MyDatabase := COPYSTR(MyContext,1,44);
    MyServer := COPYSTR(MyContext,73,50);
    
  • sabzamsabzam Member Posts: 1,149
    Hi Denster,

    Thanks for your reply, I'll test it out.
  • sabzamsabzam Member Posts: 1,149
    Hi Savatage,

    What type of variable would WSHShell be?
  • fverkelfverkel Member Posts: 66
    Hi Sabzam,

    WSHShell = Automation 'Windows Script Host Object Model'.WshShell
    WSHExec = Automation 'Windows Script Host Object Model'.IWshExec
    WSHTxt = Automation 'Windows Script Host Object Model'.TextStream
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • KYDutchieKYDutchie Member Posts: 345
    Why use the Wshell if you're not on RTC?

    Nav does have the ENVIRON command.
    You can do
    ComputerName := ENVIRON('COMPUTERNAME')
    

    Here are some other options for ENVIRON:
    ALLUSERSPROFILE, APPDATA, CLASSPATH, CLIENTNAME, CommonProgramFiles, COMPUTERNAME, ComSpec, FP_NO_HOST_CHECK, HOMEDRIVE, HOMEPATH, LOGONSERVER, NUMBER_OF_PROCESSORS, OS, Path, PATHEXT, PROCESSOR_ARCHITECTURE, PROCESSOR_IDENTIFIER, PROCESSOR_LEVEL, PROCESSOR_REVISION, ProgramFiles, PROMPT, QTJAVA, SESSIONNAME, SystemDrive, SystemRoot, TEMP, TMP, USERDNSDOMAIN, USERDOMAIN, USERNAME, USERPROFILE VS80COMNTOOLS,windir

    These have always worked for me.

    Hope this helps,

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
Sign In or Register to comment.