Solved

Detecting a SiteName with a vbs script

Posted on 2007-03-29
7
797 Views
Last Modified: 2013-11-26
Hello Everyone,

I have a login Script and I need it to test for the SiteName as we have over 100 of them.  If a user goes to another site the script want run unless the SiteName is changed to the site where they are.  Can anyone tell me how I can make this script test for the site.

Set objADSysInfo = CreateObject("ADSystemInfo")
If objADSysInfo.SiteName = "DummySite" Then

Thank you Very Much for your help
0
Comment
Question by:CEAllen6216
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18816676
Something like this?

Dim objShell:Set objShell=CreateObject("Wscript.Shell")
Set objADSysInfo = CreateObject("ADSystemInfo")
Select Case objADSysInfo.SiteName
  Case "DummySite" Then
     objShell.Run "cscript DummySite.vbs"
  Case Else
     objShell.Run "cscript GenericLogonScript.vbs"
End Select
0
 

Author Comment

by:CEAllen6216
ID: 18818359
sirbounty,

in the case statements do I need to list all of the SiteNames in a Case Else
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18818591
List them following the format above...

Select Case objADSysInfo.SiteName
  Case  "Site1"
  Case "Site2"
  Case "Site3"
'...etc
  Case Else 'for sites not accounted for or for the same processing to occur on several...
0
 

Author Comment

by:CEAllen6216
ID: 18890056
Sir Bounty,

This was very helpful.  Thank You very much.  We implemented this and it worked for us.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18890064
Glad I could help. :^)
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Make the most of your online learning experience.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Progress
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question