UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Get Just The Server Name, n/a    
 
   
strBean
post Apr 22 2014, 05:06 PM
Post#1


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


Hi - driving myself nuts with this. I'm trying to find a method of one of the standard scripting objects that will simply tell me the name of the server where the script file is located. FileSystemOject, WScript.Shell, WScript.Network ... or?
can get the full path. Am I going to have to split the path and parse out the server name, or is there some built-in method that would do this?
<
Go to the top of the page
 
theDBguy
post Apr 22 2014, 05:14 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,221
Joined: 19-June 07
From: SunnySandyEggo


Hi Sam,
Not sure if this is what you meant.
Go to the top of the page
 
strBean
post Apr 22 2014, 05:21 PM
Post#3


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


GAH!! I saw that several times, thought it was just one more way to get the local computer name.
need a nap.
Thanks!!
Go to the top of the page
 
theDBguy
post Apr 22 2014, 05:31 PM
Post#4


Access Wiki and Forums Moderator
Posts: 71,221
Joined: 19-June 07
From: SunnySandyEggo


Hi Sam,
Please try it out and let me know if it doesn't do what you need. I just noticed that I need to update the comment in that code because it was a copy and paste from the other function called UserDomain(). Maybe that's the one you actually need.
Go to the top of the page
 
strBean
post Apr 22 2014, 05:37 PM
Post#5


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


Oops, no cigar. I get the local computer name.
ime to parse the Path, or do you have another idea?
Go to the top of the page
 
strBean
post Apr 22 2014, 05:42 PM
Post#6


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


I think I've looked at Environ("USERDOMAIN") and it didn't do what I need. I'll look again.
Go to the top of the page
 
strBean
post Apr 22 2014, 05:48 PM
Post#7


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


Just tried
WScript.CreateObject("WScript.NetWork").UserDomain
ope. This domain has many servers.
Go to the top of the page
 
theDBguy
post Apr 22 2014, 06:22 PM
Post#8


Access Wiki and Forums Moderator
Posts: 71,221
Joined: 19-June 07
From: SunnySandyEggo


Can you post the code to get the full path and a sample outcome?
Go to the top of the page
 
strBean
post Apr 22 2014, 06:33 PM
Post#9


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


strPath = fso.GetAbsolutePathName(".")
quot;\\esd1gpoma01\switchboard$\Upgrades"
Parsing works!
strServer = "\\" & Split(strPath,"\")(2)
"\\esd1gpoma01"
Odidn't know it would work in VBS like it does in VBA.
Solved.
Thanks for the nudge!
Go to the top of the page
 
theDBguy
post Apr 22 2014, 06:59 PM
Post#10


Access Wiki and Forums Moderator
Posts: 71,221
Joined: 19-June 07
From: SunnySandyEggo


Hi Sam,
Good deal! Glad to hear you got it sorted out. C
Go to the top of the page
 
strBean
post Apr 23 2014, 02:19 PM
Post#11


UtterAccess VIP
Posts: 4,892
Joined: 25-September 02
From: Washington State


Huh!
On the machine of one of my users, if a hyperlink to the script is clicked in an email (that's how I distribute):
strPath = fso.GetAbsolutePathName(".")
returns
"C:\Progarm Files (x86)\Microsoft Office\Office14"
Bother!
Okay, this works on my machine and on the other one (returns the full path starting with the server name, even if launched from an email link):
WScript.ScriptFullName
Odon't understand, but as long as it works...
Go to the top of the page
 
theDBguy
post Apr 24 2014, 10:03 PM
Post#12


Access Wiki and Forums Moderator
Posts: 71,221
Joined: 19-June 07
From: SunnySandyEggo


Hi Sam,
Thanks for the update. ":thumbup:" border="0" alt="thumbup.gif" />
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    13th December 2017 - 12:30 AM