Solved

delete folder on multiple computers

Posted on 2013-10-28
3
356 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

772 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