Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

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…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

863 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

20 Experts available now in Live!

Get 1:1 Help Now