Solved

Execute a file as soon as the user logged in

Posted on 2011-03-07
14
459 Views
Last Modified: 2012-05-11
Dear Experts ,
I need to execute this c:\program files\ccleaner\ccleaner.exe /auto as soon as the user logged in  (as part of the domain or to a local computer)  The machines are Windows XP and windows 7

how can I do this. I am looking at other posts trying to find out what entry in the registry I should check but nothing yet.
Please I need to run this for machines that are not part of any domain also, so for users that log in locally to the PC.

Thanks a lot.
0
Comment
Question by:anbant
  • 4
  • 2
  • 2
  • +5
14 Comments
 
LVL 2

Accepted Solution

by:
grossac earned 200 total points
Comment Utility
Either create a shortcut in the Startup folder on the Start Menu or add a key to: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
0
 
LVL 8

Assisted Solution

by:ragnarok89
ragnarok89 earned 20 total points
Comment Utility
You can also just put a shortcut to the item in the Startup folder (XP) and the Win7 equivalent.
0
 
LVL 12

Assisted Solution

by:mattclarified
mattclarified earned 20 total points
Comment Utility
The easist way is to put a shortcut to the program in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
This is the new 'All Users' folder
You can also get to this by going to the programs menu, find 'Startup' and right click the explore all users

M@
0
 
LVL 2

Expert Comment

by:grossac
Comment Utility
Isn't that what I stated already? "create a shortcut in the Startup folder on the Start Menu"
0
 
LVL 12

Expert Comment

by:mattclarified
Comment Utility
Yes it is, and when I looked at the question it had no comments, thats why I answered.  
0
 
LVL 5

Assisted Solution

by:godd31
godd31 earned 140 total points
Comment Utility
What everyone else posted should work - But because you have a domain I didn't see the option mentioned to do this via a login script Or the use of group Policy which would be ideal for running a file at user login. This article speaks to the Group Policy method. http://support.microsoft.com/kb/314488

Hope that helps!
0
 
LVL 1

Author Comment

by:anbant
Comment Utility
Thanks for all your answers.
 I should have explained myselft better, I am sorry.
 There are different domains (aorund 15) and around 200 machines that are not part of the domain.
I use Kaseya to manage these workstations so I need something that I can do with Kaseya (like creating an entry in the registry or execute a command in command line)

I don't want the user to go manually and "click" in the ccleaner icon this should be done automatically.
I will test the registry solution to test if this works, I cant find the path C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup  but that will mean to go manually in each pc isn't?

Thanks again.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:anbant
Comment Utility
I was also thinking to create a Group Policy but I dont think creating 15 group policy would be time efficient.
0
 
LVL 5

Assisted Solution

by:godd31
godd31 earned 140 total points
Comment Utility
Well if you wanted to pursue the group policy route then your concerns will not be much headache. Because with Group Policy Management Console, you can backup, restore, export and import group policies from one domain to another domain.

To backup/export the GPO

1. Open Group Policy Management from Administrative Tools.
2. Click Group Policy Object
3. Right click on the GPO you want to backup or export.
4. Select Backup to back up the GPO.

To restore/import GPO

1. Open Group Policy Management from Administrative Tools.
2. Click Group Policy Object
3. Create a new GPO
4. Right click on the GPO you just created
5. Select restore or Import Settings.

There's probably another hundred methods to do this. You could create a VBS script to copy the file to all of your desktops, you just need to be an admin on all the domains.

Just update computers.txt with a list of computer names or ip's and change the path to the shortcut file you want to copy.
Const ForReading = 1
Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\Computers.txt")

Do Until objFile.AtEndOfStream
    strComputer = objFile.ReadLine
    strRemoteFile = "\\" & strComputer & "\C$\Scripts\Test.doc"
    objFSO.CopyFile "C:\Scripts\Test.doc", strRemoteFile, OverwriteExisting
Loop

But as i said there are probably 100 different ways to do this. :)
0
 
LVL 8

Assisted Solution

by:MarkieS
MarkieS earned 20 total points
Comment Utility
Just to add my bit!!

The HKLM\Software\Microsoft\Windows\CurrentVersion\Run entry will execute and complete BEFORE any Current user actions (Startup shortcuts, Registry run entries etc) are initiated....

Applying Group Policy to Computer will ensure no user interference is possible.
0
 
LVL 14

Expert Comment

by:Don Thomson
Comment Utility
Why can't you use the "Patch Management" function of Kaseya - Seems that is exactly what you want to do. Put it in like an update
0
 
LVL 4

Expert Comment

by:mathi28
Comment Utility
0
 
LVL 1

Author Comment

by:anbant
Comment Utility
Thanks all for your answers,  I haven't been able to test more thoroughly because our phone system crashed and we are trying to make it work.


@DTHConsulting: no it cannot be done with Kaseya Patch Management ,   I am familiar with the Patch Management and what I am trying to do is running ccleaner  with a script that it is triggered everytime that the user logs in.
 
So CCleaner can "know" what profile to clean. Again this works perfectly if the user is logged in but it is a pain to find out when the user is logged in +  having all the browsers closed ( CClaner does not run properly if a browser IE, Firefoz, Chrome is open) .

I like very much the Group Policy but I dont want to lose the link that means writing in a log everytime that the CCLeaner script runs. I will be "breaking" the link  between the info I pull from reports with Kaseya.  It seems that this is more complicated that what was originally stated.

I might write another script in this case. Ummm  well I hope to get this more urgent problem solvem (phone system) and went back to the script.
Do not worry I will still grant the points :)
Thanks a lot.
0
 
LVL 1

Author Comment

by:anbant
Comment Utility
Thanks all for your answers. This is the final script that work well with Kaseya (it is designed for 32 bits OS)
-------------


Install and set Ccleaner
---Write file VSASharedFiles\ccsetup304.exe to c:\temp\ccsetup304.exe
---Pause this procedure for 120 seconds to give a previous action time to complete
---Execute c:\temp\ccsetup304.exe /s as Execute as the system account without waiting
---Pause this procedure for 120 seconds to give a previous action time to complete
---Write file VSASharedFiles\ccleaner.ini to c:\Program Files\Ccleaner\ccleaner.ini

IF Registry Path Value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Current Version\Run\CCleaner  Does Not Exist
Set registry patch HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Ccleaner of datatype REG_SZ  to value c:\Program Files\CCleaner\ccleaner.exe /auto
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now