script to rename folder on 238 machines in network

P

PGB

I am writing a script such that it will connect to every single pc we
have in the building and will rename a folder on every machine ( about
228 machines). The folder is basically a users local profile, so on an
NT machine it is C:\WINNT\Profiles\profilename and on 2k machines it
is C:\Documents and Settings\profileneam. So far the only solutions
that I've been able to come up with is to have a script that uses net
use here is a sample of the code

echo


net use n: \\sfsmk179\C$
n:
cd Documents and Settings\
rename t4pmb t4pmb.old
C:
net use n: /delete

net use o: \\sfsmk179\C$\WINNT\Profiles
o:
rename t4pmb t4pmb.old

C:
net use o: /delete

Basically, i use two drive letters one will connect to an NT machine
(drive o:) and one will connect to a 2k (drive n:).

and will just throw the commands to rename the foldes. My concern is
that sometimes when I am about to disconnect drive o: (and only
happens to drive o:) I get a prompt saying:

"There are open files and/or incomplete directory searches pending on
the
connection to o:.

Is it OK to continue disconnecting and force them closed? (Y/N) [N]:"


This is a nuisance since it defeats the purpose of the script which is
to automate everything and should run unsupervised.

Can you give some advice?


PGB
 
W

Walter Schulz

net use n: \\sfsmk179\C$
n:
cd Documents and Settings\
rename t4pmb t4pmb.old
C:
net use n: /delete

net use o: \\sfsmk179\C$\WINNT\Profiles
o:
rename t4pmb t4pmb.old

C:
net use o: /delete

====machinelist.txt====
sfsmk179
sfsmk180
=====EOL

===renfolder.cmd====
for /F "skip=1" %%a in (machinelist.txt) do call :step2 %%a
goto :EOF

:step2
gettype \\%1 /s
if errorlevel=8 goto NT40
if errorlevel=7 goto NT40
if errorlevel=6 goto 2000
if errorlevel=5 goto NT40
if errorlevel=4 goto 2000
if errorlevel=3 goto NT40
if errorlevel=2 goto 2000
if errorlevel=1 goto NT
goto :EOF

:NT40
ren \\%1\admin$\profiles\t4pmb t4pmb.old
goto :EOF

:2000
ren \\%1\c$\"documents and settings"\t4pmb t4pmb.old
goto :EOF

REM ====EOF====

Ciao, Walter


1 Windows NT Workstation
2 Windows 2000 Professional installation
3 Windows NT Server Non-Domain Controller
4 Windows 2000 Server Non-Domain Controller
5 Windows NT Server Domain Controller
6 Windows 2000 Server Domain Controller
7 Windows NT [Enterprise/Terminal] Server Domain Controller
8 Windows NT [Enterprise/Terminal] Server Non-Domain Controller
 
M

Mark V

PGB wrote in
I am writing a script such that it will connect to every single pc
we have in the building and will rename a folder on every machine
( about 228 machines). The folder is basically a users local
profile, so on an NT machine it is C:\WINNT\Profiles\profilename
and on 2k machines it is C:\Documents and Settings\profileneam. So
far the only solutions that I've been able to come up with is to
have a script that uses net use here is a sample of the code

I suppose you realize that if all you do is rename a (profile) folder
the account will not use it on the next login. And that it will be
locked if the user is logged in. There must be more to your project
than this, so I just mention it in passing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top