Solved

Detecting a SiteName with a vbs script

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 …

809 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