Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Run a script when specific user logs on

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,34935
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run a script when specific user logs on
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Run a script when specific user logs on - 5/29/2006 1:28:38 AM   
  Zecandyman

 

Posts: 6
Score: 0
Joined: 5/29/2006
Status: offline
I have made several scripts that run at startup on my school network but I have recently thought of some scripts that I want to only run when a specific user logs on.

I place the script that i want loaded at startup in the startup folder in the startmenu and so at startup it runs the following script:

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "File to Run"
WScript.Quit

Also im not sure if "option explicit" is even nessesary.

Basicly I need this script edited in a way that the "file to run" is only run when lets say Chris.Baker is logged in.

If anyone can help me with this it would be greatly appreciated.

< Message edited by Zecandyman -- 5/29/2006 1:32:26 AM >
 
 
Post #: 1
 
 RE: Run a script when specific user logs on - 5/29/2006 2:53:05 AM   
  avipenina

 

Posts: 101
Score: 0
Joined: 4/24/2006
Status: offline
the short way is to put the script that you want for the specific user in his startup directory the path should be like this "C:\Documents and Settings\username\Start Menu\Programs\Startup"

or if you connect to server (Domain) you can do that by logon script.

< Message edited by avipenina -- 5/29/2006 2:59:41 AM >

(in reply to Zecandyman)
 
 
Post #: 2
 
 RE: Run a script when specific user logs on - 5/29/2006 11:41:15 AM   
  Zecandyman

 

Posts: 6
Score: 0
Joined: 5/29/2006
Status: offline
That wont work, whenever a user logs in here a new user profile is made, llike chris.baker.001 chris.baker.002 etc.

(in reply to Zecandyman)
 
 
Post #: 3
 
 RE: Run a script when specific user logs on - 5/29/2006 7:04:32 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
Hope this helps. This will even allow you to run it on specific days.  '1 =Sunday, 2=Mon, 3=Tues, 4=Wed, 5=Thurs, 6=Fri, 7=Sat


On Error Resume Next

Dim WshNetwork, WshShell, objFSO

Set WshNetwork = CreateObject("Wscript.Network")
Set WshShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

strDay = 2 'default for unknown configured user

Select Case LCase(strUserName)
Case "bfrank", "alan", "steve"
    strDay = 4
Case "judy", "sophie", "laura"
    strDay = 5
End Select

If CStr(strDay) = CStr(Weekday(Now())) Then
now run your program
End If

< Message edited by gdewrance -- 5/29/2006 7:10:08 PM >

(in reply to Zecandyman)
 
 
Post #: 4
 
 RE: Run a script when specific user logs on - 5/30/2006 2:27:51 PM   
  Zecandyman

 

Posts: 6
Score: 0
Joined: 5/29/2006
Status: offline
i figured out a way of doing it. thanks for your help.

(in reply to Zecandyman)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run a script when specific user logs on Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts