Welcome message

From: Gary (anonymous_at_discussions.microsoft.com)
Date: 06/10/04


Date: Thu, 10 Jun 2004 03:36:01 -0700

Could i get some help with this VB welcome message, i am using Win2k server and 2000 pro XP descktops

Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set WSHSysEnv = WshShell.Environment("PROCESS")

Dim EXCLUDE_COMP, dataEC, aryEC, counter, msgSCRIPT
Dim COMPNAME, USERNAME, LOGONSERVER

'Get Computers where script will skip to welcome message
'==========
EXCLUDE_COMP = "skip_pc.txt"
dataEC = oFSO.OpenTextFile(EXCLUDE_COMP,1).ReadAll
aryEC = Split(dataEC,vbCrLf)
msgSCRIPT = "All logon script functions" & Chr(10) & _
            "executed successfully!"

COMPNAME = WshNetwork.ComputerName
USERNAME = WshNetwork.UserName
LOGONSERVER = WSHSysEnv("LOGONSERVER")

'=== Exit Script program (Welcome Message) ===
Sub EXITSCRIPT
   WScript.Echo "Hello " & USERNAME & "!" & Chr(10) & _
                "Your Logon Server is " & LOGONSERVER & "." & Chr(10) & _
                "Logon to " & COMPNAME & " is complete!" & Chr(10) & _
                msgSCRIPT
   WScript.Quit
End Sub

'=== Exit script if Computer name matches exclude comp array ===
   For counter = 0 To Ubound(aryEC)
      If aryEC(counter) = COMPNAME Then
         msgSCRIPT = "Note: Many logon script functions" & Chr(10) & _
                     "were skipped to log on to this PC."
         EXITSCRIPT
      End If
   Next