In the good old days when every computer was hardwired to the network, processing the logon script only when a user first logged on to the computer made sense. Today remote connections are made through VPN and RAS and Windows 2000 has the capability to be dynamically plugged into the network - In all these cases the logon script does not run. This WMI script will ensure that the logon script runs for all of these dynamic connection scenarios. Read on for Version 2.9 Updates and Fixes
This script uses WMI event monitoring to watch for changes to the ip information - this method is very different than polling methods because it does not cause any noticable CPU overhead. The network connection version monitors the WMI class Win32_NetworkAdapterConfiguration. See the include documentation for much more information on how to setup the script!
Note for W2K Users: WMI Event monitoring can have a noticable impact on system performance for pre-SP2 installations.
- NOS independent - no matter which Network Operating System you use or how many you have in your company, as long as Windows is running on the client, this script will execute the logon script.
- Support for classless subnet address matching with supernetting to determine which network or network segment has been attached to - allows accurate matching of entire corporate network or any subsection of it.
- Selective service startup for starting up services when a network connection is made (e.g. software distribution related services like the SMS Client). This relieves the problems caused mobile computers that connect to various sections of you WAN trigger bandwidth intensive tasks like backup or software distribution when they are not at their home site.
- Comprehensive Tracing / Error / Logging routine for debugging, logging script activities and if applicable, generating user error messages.
- Simplified script to use graceful failover of logon script execution - if the logon script does not exist, no error is generated (can still be logged or customized to trap errors).
- Can preempt logon script based on running processes (software, network agents, etc)- generally for detecting if a mail agent (such as mapis32.exe) triggered a dial-up session. This support includes checking for multiple simultaneously running processes.
- Can preempt logon script based on file or folder existence.
Scenarios
Sample usage scenarios for this script:
Dynamic remapping of Windows Installer package repository. If your mobile users log into a remote site, but you want their package repository to be pointed locally, this script can be used to set up an environment variable or drive letter to point to a local version of the repository. (This must be combined with proper package engineering to ensure that all source list pointers are directed at an environment variable or drive letter).
- Physical site determination for Pre-Windows 2000. This script can be used to detect the physical site connected to without Windows 2000 clients or active directory. This can be helpful for consistent site level logon processing in a mixed environment.
- Selective Startup of Bandwidth Intensive "Home Site" Oriented Services. Background processes for performing backup or software distribution can be troublesome on corporate networks when they are installed on laptops that connect to more than one location on the network. Many of these services will commence operation as long as they can touch their home services, regardless of the bandwidth limitations. One or more WAN links may be traversed as these services attempt startup.
- Consistent Logon Script Processing. Ensure that logon scripts are processed whether users connect using VPN, RAS or by plugging in a laptop that has been in suspend. Ensure logon scripts whether or not a cached profile has been used to logon to Windows. Ensure that logon scripts run, regardless of the Network Operating System being used.
Version 3.0 Updates (9/18/03):
Allow script to check all connection objects upon startup - this should handle the case where folks authenticate using RAS - must use file/folder pre-emption check to prevent multiple logon script runs when logging on through a direct hardwire connection.
Added utility script dumpconnections.vbs to help identify which IP addresses are changing when connecting with RAS, VPN, etc.
Fixed crash on cached DHCP information - ip address may have been an empty string
Fixed intermittant crash when unplugging network connection while computer was running
New setup program that creates shortcuts and has an uninstall add/remove programs item
Structure changes and sample code segments to ease ability to customize
Documentation dramatically enhanced with usage scenarios and dumpconnection.vbs information
Version 2.9 Updates:
Preemption of logon script processing based file or folder existence (for pre-empting logon script has already run)
Commented sample code to demo usage of multiple subnet lists
Fixed a bug with service startup routine that prevented services from starting
Additional trace logging for better problem diagnosis
Code reorganization - easier to customize
Performance improvements
Version 2.8 Updates:
Preemption of logon script processing based on running processes (for pre-empting when mail agent initiated connection)
Fix for abnormal end when disconnecting from network and certain connection scenarios
Additional logging data for verbose logging
Bug fixes noted in script header
Version 2.4 Updates:
Support for classless subnet address matching to determine which network has been attached to - allows accurate matching of entire corporate network or any subsection of it.
Removed Win32_IP4RouteTable support due to classless subnet matching functionality
Script now monitors __InstanceOperationEvent to capture all connection types (VPN, RAS, DYNAMICIP) with a single script
Selective service startup for starting up services when a network connection is made (e.g. software distribution related services)
Comprehensive Tracing / Error / Logging routine for debugging, logging script activities and if applicable, generating user error messages.
Simplified script to use graceful failover of logon script execution - if the logon script does not exist, no error is generated (can still be logged or customized to trap errors)
Version 1.5 Updates:
Adapted to work with .BAT & .CMD logon scripts
Additional error checking for logon script execution
Single script for routetable detection and ipaddress detection
Wait time for slow connection processes
To report bugs or submit enhancement suggestions, drop me a message at darwin@desktopengineer.com
To link to this page, use the URL: http://desktopengineer.com/vpnraslogonhook.
Download Now (70Kb)
KEYWORDS: VBS, SCRIPTCODE, WMI
Topic: "Scripting"
|
|