Solved

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

Posted on 2007-12-04
4
1,121 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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