Richard
Fri Nov 30 06:21:10 PST 2007
Jake wrote:
> How would I do a vbs logon script which checked the workstation's
> ComputerName and if this name *starts* with anything else than the strings
> 'Class-A-' OR 'Class-B-' a messagebox should pop up with a custom message.
Read the computer name from the wshNetwork object. Use the Left function to
check the first 7 characters:
=======
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
If (Left(strComputer, 7) = "Class-A") Or (Left(strComputer, 7) = "Class-B")
Then
Call MsgBox("Welcome", vbOKOnly + vbInformation, "Logon Script")
End If
========
Use the UCase or LCase functions if you want to make this case insensitive.
Use the PopUp method of the wshShell method if you want the message to
timeout and the script continue after a specified number of seconds.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net
--