Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2007-12-04
4
Medium Priority
?
1,134 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 2000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

783 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