Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Script to Remove Program from Startup/Logon

Posted on 2015-02-19
9
Medium Priority
?
78 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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 …
Suggested Courses

609 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