Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Atlanta, Georgia, USA
    Thanked 0 Times in 0 Posts

    batch file question...

    in our win2k ad network there are a number of pc's that have computer names with underscore characters in them. when the win2k migration took place some of the pc's were given names with underscore characters by mistake. some of those were fixed and some were not. most of the pc's have computer names with dashes in them. we want all of the pc's to have computer names with dashes instead of the mixture. we know that some of the pc's with underscore characters can be deleted, but we aren't sure which one's those are.

    i want to know if it's possible to create a batch file that can pull usernames and computer names during login and place them in a file. i'm thinking that from this file we can match user's to pc's and get an idea of which pc's aren't actually in use on the network and can be deleted (the one's with underscore characters). if we find that there are some with underscore characters that are being logged onto we will obviously need to go to those machines to change them. the main thing i want to do is find out which pc's aren't actively being used.

    oh yeah, i do understand that if i delete a pc from ad that is used it won't be able to log onto the network.

    any help would be great. thx.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Cincinnati, Ohio, USA
    Thanked 0 Times in 0 Posts

    Re: batch file question...

    <P ID="edit" class=small>Edited by WyllyWylly on 30-Apr-02 16:44.</P>You can do it with a little ingenuity. All of the information you should need is stored by NT/2000.

    First, set up a network share that all the workstations will have access to. This way you can have the PCs run the BAT file at logon and append to a single text file, which will make your life easier. If you're worried about contention for the file (since all systems will write to it) you could alternately have the file written locally and then moved to a network share.

    The way to accomplish what you want would be similar to this:

    <pre>SET netdrive=somecomputer
    SET netshare=someshare

    ECHO COMPUTERNAME >> %netdrive%%someshare%WORKSTATION.TXT
    ECHO USER >> %netdrive%%netshare%WORKSTATION.TXT
    ECHO :-------------------------------: %netdrive%%netshare%WORKSTATION.TXT


    the ECHO USER command will return three separate items, like this:

    USERPROFILE=Cocuments and SettingsJoeUser

    There are several utilities on the 'net that can scan a text file for character strings, so if you are looking for workstations with underscores you'd need to add that extra step.

    Hope that helps!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts