DanBrill Posted January 31, 2004 Posted January 31, 2004 Hi, Running a shared solution on a Win XP peer-to-peer network. I want to find the network name of the computer that opened a file. Status(CurrentHostName) will return the network name of the computer hosting the file, and I can parse out the name of the computer on which the file is stored from Status(CurrentFilePath). (Yeah, I know, it should be the same as the host name, but hey, this isn't a perfect world. People do dumb stuff.) Status(CurrentUser) will tell me the windows logon name of the user. But I need the name of the computer, not the user. How can I get this? Thanks, Dan
cjaeger Posted January 31, 2004 Posted January 31, 2004 get it from the registry with wsh or dde /regedit
DanBrill Posted January 31, 2004 Author Posted January 31, 2004 OK. Next question. How do I do that? How can I get it returned to a FM field?
Ugo DI LUCA Posted January 31, 2004 Posted January 31, 2004 With VBScript Dan.. Link to VBScript MessageBoard
DanBrill Posted February 1, 2004 Author Posted February 1, 2004 Ok, I see you guys didn't just want to make it easy on me and give me the perfect little script to do the job. But after poking around a bit with your leads, here's what I came up with. Step one was to find out what WSH was, and then dust off my VB knowledge. Step two was to create this: Dim objNet Set objNet = CreateObject("WScript.NetWork") Dim strInfo strInfo = "User Name is " & objNet.UserName & vbCRLF & _ "Computer Name is " & objNet.ComputerName & vbCRLF & _ "Domain Name is " & objNet.UserDomain wscript.echo strInfo Set objNet = Nothing 'Destroy the Object to free the Memory ' call this program from the command line with the following: ' cscript compname.vbs>c:compname.txt ' this will direct the output to c:compname.txt and save it as CompName.vbs. When it's called from the command prompt as indicated in the notes, I get a text file that is easy enough to read and parse in FM. Thanks guys, Dan
Recommended Posts
This topic is 7671 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now