Computer Performance, Windows 2003, Exchange 2003, Logon Scripts

 

VBScript - Getting Started

Getting Started with VBScript

This section is for beginners who are copying and pasting example scripts.

My sample scripts will work on Windows 2003, Server 2003 and XP.  Avoid other clients like Windows 98 unless you get the WSH updates

Instructions to create your VBScript

  1. Navigate to the page where you want to copy the example 'VBScript.
  2. Copy all the lines inside the blue section of my sample script (Ctrl + c).
  3. Open notepad.exe, now paste the script text (Ctrl +V).
  4. In notepad, go to the File Menu, Save As script.vbs  - The .vbs extension is vital, do not let it save as a .txt file.
  5. To run the script simply double click your script.vbs (or what ever you called the file).

 

Example 1 -  A simple script to display your ComputerName

 

 

' VBScript to Display your ComputerName
' Created by Guy Thomas Jan 2003

Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "You Computer Name = " & WshNetwork.ComputerName

 

If you are ready to move on then try: -  Creating Computers

Example 2 - A script to display your VBScript version number

  (If this script fails then you need a Windows or XP machine.)

 

' VBScript
' Created by Guy Thomas Jan 2003
' Simple script to check VBScript VERSION

WScript.Echo "VBScript Version: " & ScriptEngineMajorVersion _
& "." & ScriptEngineMinorVersion
WScript.Quit

 

 

Traps when creating VBScripts

  • You missed the first ' apostrophe - make sure you start at the beginning of the line.
  • You execute the script a second time and get a  Code 80071329  - Object Already Exists, WSH message box.  The reason is that each object must have a unique name.  So if you created - say a user, you cannot run the script again without either modifying a line in the script, or deleting the first object.

 


See Also

 .


Google

Webcomputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Here is a solution to monitor, manage and archive thousands of events that are generated by devices across your entire network.  Get your free evaluation copy of GFI EventsManager.

 

Home Copyright © 1999-2008 Computer Performance LTD All rights reserved

Please report a broken link, or an error.