Solved

script to delete a file on remote PC under a current logged on user

Posted on 2007-12-04
4
1,126 Views
Last Modified: 2012-05-05
  We have about 1500 workstations that are going to get McAfee upgraded from 8.0 to 8.5.  There is a known issue with Outlook that throws a missing DLL error on startup for scanemal.dll add-in.  One of the solutions offers to delete the extend.dat file and after next Outlook restart the error will go away.  
   My plan is to reboot workstations first to clear up any open Outlook instances.  But then I need to reach in remotely and delete the extend.dat file from all the current profiles on each of the workstations.  It sounds pretty simple to me but when I asked around for a script to complete this, I was told that its a complicated process.  Is that so?  Any advice would be greatly appreciated!
0
Comment
Question by:oldreptech
[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
  • 2
4 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 20407474
You could add the following to a logon script:
del "%appdata%\microsoft\outlook\extend.dat"

Or you could use a batch script like the one below to remotely delete the files.  TO use it, paste the text into a new file with a .cmd extension.  Add the names of all target computers to a file named computerlist.txt, one per line.  Running the .cmd file will echo the commands to be executed.  Once you have tested and are satisfied that the script is behaving correctly, remove the "echo" command from Line 4.


@echo off
for /F %%G in (computerlist.txt) do (
 for /F "tokens=* usebackq" %%H in (`dir "\\%%G\c$\documents and settings" /A:D /B`) do (
  echo del "\\%%G\c$\documents and settings\%%H\application data\microsoft\outlook\extend.dat" 2>NUL
 )
)

Open in new window

0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20408381
You can run the script as a computer startup script to delete the files

regards
Chandru
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 20408405
If you do use a startup (rather than logon) script then note that the %userprofile% variable won't work and you'll need a FOR loop to go through Documents and Settings.
0
 
LVL 3

Author Comment

by:oldreptech
ID: 20414710
Thanks to both of your comments.  I decided to go with login script to make things a bit easier.  We have to use VBScript here since our master login script is written in that language.  So I took the one liner you provided and had some assistance to convert it to VB.  I am testing it now and its working out OK.  I'll give it a go next week.  
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

734 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