Solved

Script to Remove Program from Startup/Logon

Posted on 2015-02-19
9
64 Views
Last Modified: 2015-03-18
Hello, what's the best approach to remove a program that automatically starts during logon? It resides locally in C:\Program Files (x86)\XXXXX.  Is there a script I can utilize? Ideally, I'd like to push it out using GPO.

Thank you!

J
0
Comment
Question by:Ja Che
  • 5
  • 4
9 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 40620514
If the program starts at Logon, it is (most commonly) either a shortcut in one of the following locations:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\StartUp
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\<nameofprogram>
HKLM\Software\Microsoft\Windows\CurrentVersion\Run\<nameofprogram>

Check which of those it is in, then remove it with a startup or logon script.

Regards,

Rob.
0
 

Author Comment

by:Ja Che
ID: 40621631
Hi Rob, thanks for the response. I checked each location and the program resides in C:\programdata\microsoft\windows\start menu\programs\StartUp.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40622582
OK no problem.  As a StartUp script you should be able to run this VBS:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\YourLink.lnk", True

Open in new window


Regards,

Rob.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40622586
You can also use Group Policy Preferences to delete the shortcut from that folder as well.

Rob.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:Ja Che
ID: 40636212
Rob that was extremely helpful and works well. 1 question, though.

If the program has already been removed from startup, how can it be specified to ignore the file?

I receive a WSH runtime error saying "File not found". Attached is the error.

Thank you.
WSH-Error.JPG
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 40636550
Hi, that will just be a matter of checking whether the file exists before attempting to delete it.

strFile = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\YourLink.lnk"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then objFSO.DeleteFile strFile, True

Open in new window


Rob.
0
 

Author Closing Comment

by:Ja Che
ID: 40640682
Thanks, Rob. Quick and helpful!
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40640699
No problem. Thanks for the grade.

Rob.
0
 

Author Comment

by:Ja Che
ID: 40674189
You're welcome.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 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

27 Experts available now in Live!

Get 1:1 Help Now