FYI: Win2k Login Script Not Running 
Author Message
 FYI: Win2k Login Script Not Running

Hi all!

I've run into people on many occasions that have a hard time with the fact
that Win2k has some weirdness in that if you log in to a notebook with your
cached information, then use DUN to connect to your domain your login
scripts won't run.

This is documented by Microsoft as being the case--although it works in XP.
I've seen many work arounds for this including the correct way--what I call
correct--that you check the 'login with dialup networking' check box at the
CTL-ALT-DEL screen.  I've never seen a work around for this that would let
the user recieve the popup warning them that their password is going to
expire.  Which was a problem in our environment.  I know alot of people
recommend the CMAK but eww that is like a lot of work.

To the point:
I've written a script with VBS and WMI that monitors the local network
adapters instances for a WAN instance to be created (i.e. dialup).  If and
when this occurs it will calculate password expiration and can trigger a
remote--centrally managed--login script via a WSH shell.  You would need to
deploy this script to each of your remote users and put it in their 'start
up' folder.  It isn't perfect--as ADSI is SLOW--but maybe it will help
someone.
Any comments questions welcome.

Here is the script:
-------------------------------------------------------------
'WMI Login Watcher: By SGN Craig - Free to use.  Please do not remove this
tag.

Dim Event1            ' Holds the Object that the event raises
Dim EventInstance     ' Holds an Instance of the event object
Set Event1 = GetObject("winmgmts:").ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA
'Win32_PerfRawData_Tcpip_NetworkInterface'")
Do
  Set EventInstance = Event1.NextEvent
  If Instr(EventInstance.TargetInstance.Name, "WAN") > 0 Then Exit Do
Loop
Set EventInstance = Nothing
Set Event1 = Nothing
Dim WshNetwork  ' Holds network methods
Dim UserName  ' Holds User Name
Dim USR   ' Holds User Object from AD
Dim DaysLeft  ' Holds number of days until password expires
Dim WshShell            ' Holds shell script methods
Set WshNetwork = WScript.CreateObject("WScript.Network")
UserName = WshNetwork.UserName
Set WshNetwork = Nothing
Set USR = GetObject("WinNT://ENTERYOURDOMAIN/" & UserName & ",User")
DaysLeft = DateDiff("d", Now(), USR.PasswordExpirationDate)
Set USR = Nothing
If DaysLeft < 300 Then          'Obviously the 300 is for testing only
   Wscript.Echo "You password will expire in " & DaysLeft & " days."
End If
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run \\ENTERYOURPATH\login.vbs      ' Gotta use IP not machine name
here. Resolution won't be working yet.
Set WshShell = Nothing



Fri, 08 Apr 2005 23:10:01 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. vb login script not running sbsclnt.exe - MS Small Business Server

2. Login script not running right

3. Login Script for Win2K server and Win95 Clients

4. Win2k Networking Newbie Question - Logon/Login Scripts

5. System Login Script WIN2K

6. Login script - Script running before user logs on.

7. Login script - Script running before user logs on.

8. How to run a simple batch login script VB4

9. Access XP - Reports run under Win2K, not under Win98

10. Program runs on Win98 but not on Win2K

11. script works under 98, not under win2k

12. access denied to wscript at login but runs after login

 

 
Powered by phpBB® Forum Software