Solved

Detecting a SiteName with a vbs script

Posted on 2007-03-29
7
788 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven disable workspace resolution 1 37
Counting number of emails in Outlook folder by date 7 86
MS ACCESS 2010 Clear Form Button 4 62
Java array 10 55
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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