Windows Tips & Tricks UPDATE--December 15, 2003

This week, John Savill tells you how to rename a Windows 2003 DC, how to install NetBEUI in Windows 2003, how to create a script that removes all subfolders from a directory except those that you want to keep, and more.

John Savill

December 14, 2003

9 Min Read
ITPro Today logo in a gray background | ITPro Today

Windows Tips & Tricks UPDATE, December 15, 2003, —brought to you by the Windows & .NET Magazine Network and the Windows 2000 FAQ site
http://www.windows2000faq.com

This Issue Sponsored By

Argent Software
http://www.argent.com/products/download_whitepaper.cgi?product=mom&&Source=WNT

Storactive
http://www.storactive.com

1. Commentary

2. FAQs

  • Q. How can I rename a Windows Server 2003 domain controller (DC)?

  • Q. How can I install NetBEUI in Windows Server 2003?

  • Q. How can I keep certain subfolders in a directory but remove all other subfolders?

  • Q. Does Windows support Serial ATA (SATA) drives?

  • Q. What actions occur when I click Repair on a network connection in Windows XP and later?

3. Announcements

  • Announcing a New eBook: Content Security in the Enterprise--Spam and Beyond

  • Take Our Print Publications Survey!

  • New--Microsoft Security Mobilization Road Show 2004!

4. Event

  • Receive a Free Identity Management White Paper!

5. Contact Us

  • See this section for a list of ways to contact us.

Sponsor: Argent Software

NETWORK TESTING LABS COMPARES MOM TO THE ARGENT GUARDIAN
Network Testing Labs, one of the world's leading independent research companies, put together a comprehensive Comparison Paper on two leading enterprise monitoring solutions. Their conclusion: "The Argent Guardian easily beats out MOM in all our tests... The Argent Guardian will cost far less than MOM and yet provide significantly more functionality." Find out for yourself why organizations like Major League Baseball, GE Capital, AT&T, Harley Davidson, and Nokia all rely on The Argent Guardian for their enterprise monitoring and alerting needs. Download this Comparison Paper now:
http://www.argent.com/products/download_whitepaper.cgi?product=mom&&Source=WNT

1. Commentary
by John Savill, FAQ Editor, [email protected]

This week, I tell you how to rename a Windows Server 2003 domain controller (DC), how to install NetBEUI in Windows 2003, and how to create a script that removes all subfolders from a directory except those that you specifically want to keep. I also tell you about support for Serial ATA (SATA) drives in Windows and what actions occur when you click Repair on a network connection in Windows XP and later.

Sponsor: Storactive

Love Exchange! Get Fast & Easy Message Backup & Recovery—FREE Demo! Learn how Storactive LiveServ for Exchange Servers provides continuous backup and rapid, zero-loss recovery of individual messages up to entire data stores. LiveServ's disk-based backup complements existing systems to close backup windows, recover downed servers up to the point of failure (even if log files are destroyed), easily protect user mailboxes, eliminate redundancies, roll past and surgically remove viruses/corruption from your database, and keep email up and running. Click for FREE Whitepaper, Demo and Trial!
http://www.storactive.com

2. FAQs

Q. How can I rename a Windows Server 2003 domain controller (DC)?

A. If the DC's domain level is set to Windows Server 2003, you can use the Netdom tool to rename the DC. Microsoft supplies Netdom as part of the Windows Support Tools, which are available from the Windows 2003 installation CD-ROM. To rename the DC using Netdom, perform the following steps:

  1. Start a command-prompt session.

  2. Add the new name to the current server (it will now have two names) by typing

    netdom computername  /add:

    For example, when I typed

    netdom computername gotham.savilltech.com /add:omega.savilltech.com

    my computer displayed the following message:

    Successfully added omega.savilltech.com as an alternatename for the computer.The command completed successfully.
  3. If multiple DNS servers are used, you must wait until the new name replicates to all authoritative DCs. After the new name has replicated, continue to the next step.

  4. Make the new name the primary name for the machine by typing

    netdom computername  /makeprimary:

    For example, when I typed

    netdom computernamegotham.savilltech.com /makeprimary:omega.savilltech.com

    my computer displayed the following message:

    Successfully made omega.savilltech.com the primaryname for the computer. The computer must be rebooted forthis name change to take effect. Until then this computermay not be able to authenticate users and other computers,and may not be authenticated by other computers in theforest. The specified new name was removed from the listof alternate computer names. The primary computer name willbe set to the specified new name after the reboot.The command completed successfully. 
  5. Reboot the computer.

  6. After you reboot the machine, wait until all the domain locator records replicate to all authoritative DNS servers. After the replication is finished, check to ensure that the rename worked successfully by checking the name on the Computer Name tab of the Control Panel System applet. You can also view all computer names by typing

    netdom computername  /enumerate

    For example, when I typed

    netdom computername omega.savilltech.com /enum

    my computer displayed the following:

    All of the names for the computer are:omega.savilltech.comgotham.savilltech.comThe command completed successfully. 
  7. You can now remove the old name by typing

    netdom computername  /remove:

    For example, when I typed

    netdom computernameomega.savilltech.com /remove:gotham.savilltech.com

    my computer displayed the following:

    Successfully removed gotham.savilltech.com as an alternatename for the computer.The command completed successfully.

You can enumerate the names again to show the old name has been removed.

Q. How can I install NetBEUI in Windows Server 2003?

A. Microsoft doesn't ship Windows 2003 with NetBEUI and doesn't support the protocol in the OS. However, if you require NetBEUI, you can install the version supplied on the Windows XP installation CD-ROM in the valueaddmsftetetbeui subfolder. Copy the nbf.sys file into the %systemroot%system32drivers directory, copy netnbf.inf into the %systemroot%inf directory, then open the network connection properties and click Install to add NetBEUI.

Q. How can I keep certain subfolders in a directory but remove all other subfolders?

A. I maintain my own documents area, and I point My Documents to this location. Many software applications automatically create their own folders in this area that I don't want to maintain. The best method I've found for deleting all folders except for the ones that I've created is to create and run the following script:

@echo offREM -- Delete everything from a folder except those subfolders listed.D:cd Documentsdir /ad /b > %temp%folders.listREM -- Remove from the file those folders that you want to keep.findstr /x /v "Books" %temp%folders.list > %temp%folders1.listfindstr /x /v "Fitness" %temp%folders1.list > %temp%folders.listfindstr /x /v "Personal" %temp%folders.list > %temp%folders1.listfindstr /x /v "SavillTech" %temp%folders1.list > %temp%folders.listfindstr /x /v "Seminars" %temp%folders.list > %temp%folders1.listfindstr /x /v "Technical" %temp%folders1.list > %temp%folders.listREM -- Delete all remaining subfolders.For /f "delims=" %%i in (%temp%folders.list) do rmdir /s /q "%%i"

The script outputs the names of all subfolders to a file. Next, it uses Findstr to output all lines in that first file that don't match the passed text to a second file that the script uses as input on the next line. Notice that the filenames alternate between folders.list and folders1.list. The reason the filenames alternate is because if you try to use Findstr from within a file to search the file for a certain string and output the names of the subfolders to the same file, you get a blank file. Finally, the script uses the second file as input to a For loop that removes each subdirectory left in the first file.Be aware that in my example, the final file that the script creates is folders.list. However, if you want to keep an odd number of folders, your final file would be folders1.list, which you would then use instead of folders.list as the input to the For loop. Failure to specify the correct output file will remove subfolders that you didn't intend to remove.

Q. Does Windows support Serial ATA (SATA) drives?

A. SATA is a new hard disk standard that does away with the standard 40-pin IDE cable in favor of a new thin 7-pin cable. SATA uses only one cable per device to connect the drive to the controller, which eliminates the master drive and slave drive concept. The power connector is also different, although some SATA drives also provide an old-style power connector.

Out of the box, no current Windows version, including Windows Server 2003, supports SATA drives. However, just as you can add a SCSI controller to Windows, you just need to add the correct SATA driver that ships with the motherboard or SATA host adapter. After you've installed the driver, Windows will be able to see the SATA controller and any attached devices. For more information about SATA, visit the SATA Working Group Web site at http://www.serialata.org.

Q. What actions occur when I click Repair on a network connection in Windows XP and later?

A. If you right-click a network connection and select Status, Windows displays information about the connection's speed, duration of connection, and packet activity. For XP and later, a Repair option appears on the Support tab. When you click Repair, Windows attempts to resolve a range of problems. Specifically, the OS

  • attempts to renew the DHCP lease, if the connection obtains its IP address through DHCP, by using a broadcast message

  • flushes the Address Resolution Protocol (ARP) cache by using the command

    arp -d * 
  • flushes the NetBIOS cache by using the command

    nbtstat -R
  • flushes the DNS cache by using the command

    ipconfig /flushdns
  • reregisters the NetBIOS name and IP address with WINS by using the command

    nbtstat -RR 
  • reregisters the computer name and IP address with DNS by using the command

    ipconfig /registerdns

3. Announcements
(from Windows & .NET Magazine and its partners)

  • Announcing a New eBook: Content Security in the Enterprise--Spam and Beyond


This eBook explores how to reduce and eliminate the risks from Internet applications such as email, Web browsing, and Instant Messaging by limiting inappropriate use, eliminating spam, protecting corporate information assets, and ensuring that these vital resources are secure and available for authorized business purposes. Download this eBook now free!
http://www.windowsitlibrary.com/ebooks/spam/index.cfm

  • Take Our Print Publications Survey!


To help us improve the hardware and software product coverage in the Windows & .NET Magazine print publications, we need your opinion about what products matter most to you and your organization. The survey takes only a few minutes to finish, so share your thoughts with us at
http://websurveyor.net/wsb.dll/12237/editorsproduct.htm

  • New--Microsoft Security Mobilization Road Show 2004!


Join industry-guru Mark Minasi on this exciting 20-city tour and learn more about tips and best practices to secure your Windows Server 2003 and Windows 2000 networks. There is no charge for this event, but space is limited, so register today!
http://www.winnetmag.com/roadshows/computersecurity2004

4. Event
(brought to you by Windows & .NET Magazine)

  • Receive a Free Identity Management White Paper!


Are your existing identity-management and access-control solutions fragmented, duplicated, and inefficient? Attend this free Web seminar and discover how to automate and simplify identity creation, administration, and access control. Leverage your investment in Microsoft technologies and benefit from greater security, improved productivity, and better manageability. Register now!
http://www.winnetmag.com/seminars/identity

5. Contact Us
Here's how to reach us with your comments and questions:

This weekly email newsletter is brought to you by Windows & .NET Magazine, the leading publication for Windows professionals who want to learn more and perform better. Subscribe today.
http://www.winnetmag.com/sub.cfm?code=wswi201x1z

Receive the latest information about the Windows and .NET topics of your choice. Subscribe to our other FREE email newsletters.
http://www.winnetmag.net/email

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like