Solved

Detecting a SiteName with a vbs script

Posted on 2007-03-29
7
776 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Glad I could help. :^)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now