N
N
nuzni2011-09-28 06:22:04
Active Directory
nuzni, 2011-09-28 06:22:04

Disabling all shared folders in a WIN2003 domain?

Good afternoon.
Help to cope with mass shutdown of network folders in the Domain.
I didn’t find any scripts, except for disabling “administrative resources” according to the principle Admin $ C $ D $, but I don’t need to disable them.
150 computers, I'm going to lose a lot of weight, help)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
korvindest, 2011-09-28
@nuzni

I wrote you a simple batch file, which, when running on a computer, removes all non-hidden balls. The batch file must be run on behalf of the admin, otherwise it will not work.

::DropShares.cmd
@echo off&&cls&&goto :Begin

:DeleteShare
  set shareName=%~1
  :: если последний символ доллар то шару не трогаем, валюта еще пригодиться
  :: остальные удаляем
  if "%shareName:~-1%" NEQ "$" (   
    net share /DELETE %shareName%
  )
goto :EOF

:Main
  :: перебираем все шары доступные на компьютере
  for /F "tokens=1" %%f in ('net share') DO (
    if EXIST \\%COMPUTERNAME%\%%f (
      call :DeleteShare "%%f"
    )
  )
goto :EOF

:Begin
Call :Main

PS
As always, I ask all haters of the CMD language to express their emotions in the comments, otherwise I will take the series of articles on Maven to the grave with me.

R
RuJet, 2011-09-28
@RuJet

If you disable it in principle, you can stop the Server service.
And then quietly disable all access

A
Aidos, 2011-09-28
@Aidos

if the drive letter is Z then net use Z: /delete register on the computer logon

N
nuzni, 2011-09-28
@nuzni

I hope it was not I who imposed this dey on you and
read your article. She inspired that this question can be asked here on Habré, and the question itself appeared a little earlier than your article.
Loved the post yesterday. I will give this article to our "non-admin", because of which I (the programmer) was given to find or write a solution. It’s easier for him to go through the plant and rename it with his hands, transfer the machine to the domain, it’s easier to sit for 30 minutes than to write a line of code)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question