Solved

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

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to count occurrences of each item in an array.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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