Login | |
|
 |
RE: Notification script - 3/24/2006 8:08:27 AM
|
|
 |
|
| |
ebgreen
Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
|
What if you have the logon script schedule a scheduled task for 24 hours in the future to pop up the message? Of course you would need to have a logoff script that would remove the scheduled task.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Notification script - 3/24/2006 8:14:56 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
im assuming you have a AD domain by saying this, but there is a gpo that you can use to do this i believe.
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
 |
RE: Notification script - 3/26/2006 11:53:58 PM
|
|
 |
|
| |
david.rollins2
Posts: 9
Score: 0
Joined: 3/22/2006
Status: offline
|
Yes You would be right. I could use Scheduler. I have already looked into this one though. You can't tell it every 24hrs, you also have to specify a time. And I only want the popup for those individuals logged in for more than 24 hrs. Also, yes I already know about AD. But we don't want to automatically log them off. We just want a notification.
< Message edited by david.rollins2 -- 3/26/2006 11:56:08 PM >
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 12:53:30 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
quote:
ORIGINAL: ebgreen Of course you would need to have a logoff script that would remove the scheduled task. I don't think you would need to use a logoff script, just have the logon script look for a previously scheduled task and delete it if present. quote:
ORIGINAL: david.rollins2 Yes You would be right. I could use Scheduler. I have already looked into this one though. You can't tell it every 24hrs, you also have to specify a time. And I only want the popup for those individuals logged in for more than 24 hrs. Have the logon script dynamically create it. I.e. figure out what the time is 24 hours after a logon and create the schedule based on that. Also, just wondering, but why 24 hours? Lets say that I log on at 8 am. When I leave that night, I lock my workstation. When I come in the next morning and unlock my workstation at 8 am so I can start working, I will get the message to log off.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 1:23:22 AM
|
|
 |
|
| |
david.rollins2
Posts: 9
Score: 0
Joined: 3/22/2006
Status: offline
|
So mbouchard you are saying also run a log off script to delete the task in the event that they, like you said, login at 8am and don't get the message. I understand. Would I use the Now() to set the scheduler? L12, will the script keep looping or will it just stop at the end of the text? I'm unfamilar with Looping.
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 1:33:43 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
quote:
ORIGINAL: david.rollins2 So mbouchard you are saying also run a log off script to delete the task in the event that they, like you said, login at 8am and don't get the message. I understand. Would I use the Now() to set the scheduler? L12, will the script keep looping or will it just stop at the end of the text? I'm unfamilar with Looping. Actually, Ebgreen suggested it, I was just saying that a logoff script is not really necessary as you can just delete the original scheduled task with the next logon. I was also wondering why 24 hours and gave an example. Also, I think L12 was replying to another post, atleast that is what it seems to me.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 6:11:24 AM
|
|
 |
|
| |
ebgreen
Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
|
I don't know that the real problem is determining the amount of time logged on so much as having the notification occur at a specified time interval. LastLogonTimeStamp will tell you the last time the user loggen on, but how would you determine when to run the script to access it? Every hour? Every 5 minutes? Once a day?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 6:27:55 AM
|
|
 |
|
| |
david.rollins2
Posts: 9
Score: 0
Joined: 3/22/2006
Status: offline
|
What I was planning on doing was doing a DateDiff and create a variable from that. If the DateDiff was greater than 27 then display a message.This is the code I was using with LastLogin ;Set objSystemInfo = CreateObject("ADSystemInfo") ;strDNSDomain = objSystemInfo.DomainShortName ;Set wshShell = CreateObject("WScript.Shell") ;strUser = wshShell.ExpandEnvironmentStrings("%USERNAME%") ;Set objUser = GetObject("WinNT://" & strDNSDomain & "/" & strUser & ",user") ;Wscript.Echo Now() ;WScript.Echo objUser.LastLogin ;WScript.Echo DateDiff("h", objUser.LastLogin, Now()) I would then take it ;If DateDiff > 27 Then Do something. But this code was returning info for the machine. Not the domain.
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 6:46:51 AM
|
|
 |
|
| |
ebgreen
Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
|
So this would be running on a central server? I don't know why but I thought we were looking for a solution that ran on the machine? Or am I simply confused as I often am?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Notification script - 3/27/2006 6:52:12 AM
|
|
 |
|
| |
david.rollins2
Posts: 9
Score: 0
Joined: 3/22/2006
Status: offline
|
What I would basically do is develop it as a SMS advertisement. Because we want them to essentially logoff their machines to enable patches that only install when a user logs out. So yes it would be running on a machine.
|
|
| |
|
|
|
 |
RE: Notification script - 3/29/2006 2:06:05 AM
|
|
 |
|
| |
david.rollins2
Posts: 9
Score: 0
Joined: 3/22/2006
Status: offline
|
How might I return the needed info for the user running the script without changing the user name everytime. Basically using a wildcard in place of the user name. This is what I tried already but it didn't work. Set wshShell = CreateObject("WScript.Shell") Set strUser = wshShell.ExpandEnvironmentStrings("%USERNAME%") Set objUser = GetObject(LDAP://cn=" & strUser ", ou=Finance, dc=fabrikam, dc=com") Set objLastLogon = objUser.Get("lastLogonTimestamp") What do I need to do in order to get it to work.
|
|
| |
|
|
|
 |
RE: Notification script - 3/29/2006 2:35:53 AM
|
|
 |
|
| |
david.rollins2
Posts: 9
Score: 0
Joined: 3/22/2006
Status: offline
|
I'm sorry I didn't explain it very well. Using the LDAP. Instead of putting in the user name for the line: Set objUser = GetObject(LDAP://cn=Ken Myer, ou=Finance, dc=fabrikam, dc=com) I tried this: Set objUser = GetObject(LDAP://cn=" & StrCurrentUser ", ou=Finance, dc=fabrikam, dc=com") But it doesn't work I keep receiving the " Error: Expected ')' "
|
|
| |
|
|
|
|
|