Tip

Automate switch from roaming to MANDATORY roaming profiles

If you've had it with users mucking up NT 4.0 roaming profiles, and have decided to make some or all mandatory, here's how I did it in 5 minutes (code took longer.) Usrmgr.exe allows you to ctrl-select individual users and change the profile directory location for the selected users (something I've not enjoyed with the Win2k Users and Groups MMC).

Ctrl-select the desired users, and in the profile path field change the profile path to:

[servername][profileshare]%username%.man

Then play with the following code according to your configuration.

Perl Code:

#ActivePerl 5.6.1.628
#script to rename profile folders and ntuser.dat to *.man
#kjc@jax.org 12.5.01

#create profile list where folder=%username%
system ("dir /B [driveletter]:[profileshare]profiles > proflist.txt");

# if you want to pick which profiles to
# make mandatory, stop the script here by uncommenting this line:
#end;
# and edit proflist.txt, deleting the
# folder names you don't want to make
# mandatory. Then comment out the above system command
# and let the steps below run.

# open for input
open(MYINPUTFILE, "proflist.txt");

# read file into list
my(@profiles) = <MYINPUTFILE>;

for $x (0 .. $#profiles) {

#remove the trailing carriage return
chomp $profiles[$x];

#add

Requires Free Membership to View

.man to the profile folder
system ("rename [driveletter]:profiles$profiles[$x] $profiles[$x].man");

#change ntuser.dat to ntuser.man
system ("rename [driveletter]:profiles$profiles[$x].manntuser.dat
ntuser.man");

}

close(MYINPUTFILE);


This was first published in December 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.