Login script with vbscript RRS feed

  • Question

  • I am trying to create a logon script using vbscript 
    The need that the script will filter by sitename 
    and then if the site name is "Geneva" 
     run a BAT file 

    if the site name is "Singapure" 
    run another bat file 

    can anyone please help me? 

    this is what i got untill now 

    Dim objSystemInfoDim objWSHShellDim strLogonServer 
    Set objWSHShell = Wscript.CreateObject("Wscript.Shell") 
    strLogonServer = objWSHShell.ExpandEnvironmentStrings("%LOGONSERVER%") 
    WScript.Echo "AD Logon Server: " & strLogonServer 
    Set objSystemInfo = CreateObject("ADSystemInfo") 
    WScript.Echo "AD Sitename: " & objSystemInfo.SiteName 

    Wednesday, February 12, 2014 7:44 AM


  • You need to fix your errors first.

    You need to look up how to use an"if" statement.

    if sitename = "somesite" Then
        '  do something
    elseif sitename = "othersite" Then
          '   do somthing
        ' no site matces
    End If


    • Marked as answer by zaeyal Friday, April 11, 2014 3:37 PM
    Wednesday, February 12, 2014 8:05 AM