Guy’s Scripting Ezine 1

Contents of Guy’s Scripting Ezine No 1 – Do While… Loops

I will let you into a secret; this is the first edition of my newsletter. There is always something exiting about the start of a new venture.

This week I feature a logon script. The script has twin goals:
1) To give Windows 98 clients enough TIME to logon before executing the script commands
2) To introduce you to the DO WHILE … LOOP statement.

Instructions:

Copy the Script below, paste into notepad, save with .vbs extension e.g Time.vbs. Doubleclick to test

‘VBScript
‘ Purpose to show the Sleep Command

Option Explicit
Dim oNet, sUser, startTime
Set oNet = CreateObject("WScript.Network")
‘ Get the user name. On Windows 98 the user may not be logged on
sUser = oNet.UserName
startTime = Now
Do While sUser = ""
If DateDiff("s", startTime, Now) > 30 Then Wscript.Quit
Wscript.Sleep 500
sUser = oNet.UserName
LOOP
‘ Add a network share for the "K" home drive
‘ NOTE Change alan to the name of your Server
‘ Check home exists
‘ Check a user called Guyt exists or else use & sUser
‘ Example oNet.MapNetworkDrive "K:", "\\alan\home\" & sUser
oNet.MapNetworkDrive "K:", "\\alan\home\Guyt"

WScript.Echo "K Drive Created"

‘end of script

Guy Recommends: The Free IP Address Tracker (IPAT) IP Tracker

Calculating IP Address ranges is a black art, which many network managers solve by creating custom Excel spreadsheets.  IPAT cracks this problem of allocating IP addresses in networks in two ways:

For Mr Organized there is a nifty subnet calculator, you enter the network address and the subnet mask, then IPAT works out the usable addresses and their ranges. 

For Mr Lazy IPAT discovers and then displays the IP addresses of existing computers. Download the Free IP Address Tracker

Footnote – This first edition of the Ezine was just a beginning, future Ezines were longer with more details.  In due course the Ezine grows to include ‘Guy challenges’ and  ‘out takes’.

See more about VBScript

VBScripts  • Ezines  • WMI  • Logon Scripts   • PowerShell Foreach  •Tool Kit

• Ezine 1 Loops   •Ezine 14 Loops  • Ezine 47 .put  • PowerShell Loops  • Free Web Watcher

• Ezine 90 VBS Looping  • Ezine 91 VBS Looping   • Ezine 92 LDIFDE   • Ezine 100 If