Solved

delete folder on multiple computers

Posted on 2013-10-28
3
380 Views
Last Modified: 2013-11-18
I need a script or program which can be used to delete a folder (C:\folder1) on multiple computers in our domain.
Could you please help me.
Most of my workstations are XP sp3
0
Comment
Question by:dedri
[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
3 Comments
 
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39606120
Use a domain admin account, and create a text file with one computername per line. You can easily do so with
net view>computers.txt

Open in new window

Then, run a script iterating over the file:
SET DELTEME=mydir
FOR /F "eol=;" %%M in (computers.txt) do (
     RMDIR /S /Q "%%M\c$\%DELTEME%"
)

Open in new window


The file would be on drive C: for instance, accessed via the admin share c$
0
 

Author Comment

by:dedri
ID: 39616109
the script gives an error:

C:\temp\ExecMC>(RMDIR /S /Q "computer1\D$\folder1" )
The system cannot find the path specified.

Probably we need to add somehow "\\" before computer name?
0
 
LVL 13

Accepted Solution

by:
Daniel Helgenberger earned 500 total points
ID: 39616262
Probably we need to add somehow "\\" before computer name?
You assume correct if you did not generate the computer list as mentioned above. Please modify the script if you use plain names:
SET DELTEME=mydir
FOR /F "eol=;" %%M in (computers.txt) do (
     RMDIR /S /Q "\\%%M\c$\%DELTEME%"
)

Open in new window

Note, I just added the ''\\".
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

632 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