Solved

What is the best possible way to rename computer names?  I have 200 clients?

Posted on 2004-03-26
137
4,280 Views
Last Modified: 2009-07-29
Perhaps a VB tool that will prompt me for the old computer name then the new one. Search the network and change the compute name.  Any ideas or methods?
0
Comment
Question by:Roebuck1967
  • 70
  • 56
  • 11
137 Comments
 
LVL 17

Expert Comment

by:RDAdams
ID: 10689824
What OS are you using?
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10689830
Is this a peer to peer or server to workstation network?
0
 

Author Comment

by:Roebuck1967
ID: 10689939
The OS is 2000
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10690019
Unfortunately I have never seen an easy way to change the computer name.  Usually with large networks it is easier to set the computer name to the asset number and leave it alone.
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10690282
With windows xp you can run a script to make the change.

http://www.microsoft.com/technet/community/scriptcenter/compmgmt/scrcm36.mspx
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10690522
This is the bare bones of it.  We could add code to force a user to reboot, since the name change will occur only after that happens.  Also, how are you going to generate the computer names?  You could enter them all manually, or the script could prompt for an input box, or maybe we could figure out a way based on IP addres...  But you cant have duplicate names on your network.  Here's the code, which works by modifying the registry:

-----------------------------------------------------

sNewName = "HAPPYCOMPUTER"

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV HostName ", sNewName
End With
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10690545
Actually, scratch that, use this code instead (for some reason, errors came up when I tried to delete the values):

---------------------------------------------

sNewName = "HAPPY COMPUTER"

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV HostName ", sNewName
End With
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10690599
Hi YohanShminge does this work in Windows 2000 or only in XP?
0
 

Author Comment

by:Roebuck1967
ID: 10690665
YohanShminge,

To give you some more details we are going through an AD migration.  Will your script remove the old computer name from the domain? Also will the new computer name be added to the domain?
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10690948
Oh, well AD changes things a bit... Let me get back to you on that one.  And just to set the record straight, the above script has an error in it.  "NV HostName " should be "NV HostName" - the extra space was screwing it up for 2000 for some reason.  But here it is in the working form:

sNewName = "NEWNAME"

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With
0
 

Author Comment

by:Roebuck1967
ID: 10691020
YohanShminge

We are still on NT but moving to AD.
Tired the script but nothing happens
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10691030
I havent searched too hard, but I think RDAdams' link is closest to what you're looking for.  You could test it on Win2k just to see.  I'm not sure what would happen if you ran my script under AD, but I doubt it would work.  I found the perfect script earlier today, but for some reason I cant find it back.  I'll keep looking...its really frustrating me. :-(
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10691056
Oh, well if you're not on AD yet, then we have a chance!  Nothing is supposed to happen when you run the script.  Its silent.  We can change that if you'd like.  Did you restart the computer after you ran the latest script?  Restart the computer after running the script then right-click My Computer and hit properties.  Click Network Identification and see if the name has been changed.  Make sure you change hte first line of the script so it corresponds to the name you want, like this:

sNewName = "COMPUTERNAME"
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10691078
YahanShminge take a look at the script at the following site.  This might prompt your thought process.

How do you make this script work?  Do you need special software or can you just create a .bat file?

http://www.microsoft.com/technet/community/scriptcenter/compmgmt/scrcm36.mspx
0
 

Author Comment

by:Roebuck1967
ID: 10691101
YohanShminge

Hope I'm not asking too much.  

Can the script promt me "Old computer name?"  then "New computer name?"
Can the script run from my computer (admin priv) to rename & remove client on my network?

 
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10691199
RDAdams,

I have looked at that script.  Unfortunately, I have no way to test it since I'm not currently running the active directory.  To make the script work, all you have to do is copy the code from the grey box into a text file, then save that text file as somename.VBS.  The VBS ending is key.  Then just double click the script to run it.

Roebuck1967, I have changed the script so it prompts the user for a new name only, but prompting for the old name would not be necessary, nor would the code be able to do anything with it.  As for running it from your computer, I don't think there is any way to do this.  It has to be run locally, because it changes the settings of the local machine.  You can configure it as a logon script so it runs automatically, and then the user could type in the name.  Alternately, we could work out some sort of naming convention that could choose a name automatically, perhaps reading names from a file on a server or something.  Could you give me an idea of how you're naming?

Here's the new code:

------------------------

sNewName = Inputbox("Please enter a new computer name:")

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With
0
 

Author Comment

by:Roebuck1967
ID: 10691298
I have a list of the new names in a excel spread sheet

All new names will have the following naming convention "TAKING-" followed by first five of last name and first two initials of first name. So Anthony Johnson would be = "TAKING-JohnsAn"
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10691773
Sounds like we don't even need the spreadsheet.  We could just have the user enter their full name and parse that into substrings for the computer name.  How are they currently named? Is there any way to determine the user's name without having them enter it, or is there any way to link the current computer name with an entry in your excel file?
0
 

Author Comment

by:Roebuck1967
ID: 10691838
Most of the users logon using their first initial and full last name.  So Jill Davidson is JDavidson.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10691898
I considered using usernames as the trigger, but then that leaves two problems:
1) If the user happens to log onto a computer that is not theirs, that computer will be changed to the wrong name.
2) It doesnt quite fit your formula of first five letters of the last name plus the first two letters of the first name - you're missing the second letter of the first name, you the best you could do would be "TAKING-DavidJ"

Are the computer names in your excel spreadsheet names only or do they correspond to something we might get off the user's machine?
0
 

Author Comment

by:Roebuck1967
ID: 10691940
YohanShminge

Correction formula is first five letters of the last name plus the first (ONE) letter of the first name

Spread sheet has alll the old computer names, user ID's and new computer names.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10692016
OK, so its up to you what you want to do.  I would recommend reading from the excel file.  I believe that should be easy enough, but you'll have to locate the file on a dedicated server.  Excel will also need to be installed on every machine.  If it is not, you will need to export the Excel file as a CSV text file.  If you want to go with excel, I will also need to know the row and column numbers, and exactly how many usernames you have in the sheet, and I assume you're on sheet 1?
0
 

Author Comment

by:Roebuck1967
ID: 10692179
Reading from an excel file is fine. All my clients have it installed.
Everything is from sheet 1

Column A = Old Computer Name
Column E = New Computer Name

Also need it to run only Once not erverytime a user logs on. And it a log file could be stored on the server that would be great for tracking purposes.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10692212
OK, I shall work on that, but I don't have time right now... Perhaps tomorrow night
0
 

Author Comment

by:Roebuck1967
ID: 10692331
Thats fine...I really appreciate
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10692714
OK, turns out I've got some free time ;-) I have created a script that will read from your excel file using VB automation.

Here's how it works:
First it runs through column A until it finds the computer's name, then it stores the value from the same row from column E into variable newName.
If it doesnt find its name, or finds the word "CHANGED" in column G, it quits the script.
Next, it stores the word "CHANGED" in column G, and the date and time in column H - this will act as your log file.  You can change the column values if you wish (they're numeric in the VBscript, rather than by letter), or if you dislike this method, we could always add more code to append to a separate text file on the server.
Then, once it has the name, the excel file is saved and closed and the code continues by changing the computer's name.
Once that is through, it displays a message box saying "Your computer name has been successfully changed to xxxxxx"
Let me know what you think!  I won't be around tomorrow morning.

-----------------------------------------------------

Dim objExcel, strPathExcel, strCN
Dim objFile, strGuyFile, intRow

Set objNet = CreateObject("WScript.NetWork")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "c:\CName.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

CName = Trim(objNet.ComputerName)
row = 1

newName = ""

Do While Trim(objSheet.cells(row, 1).Value) <> ""
    If Trim(objSheet.cells(row, 1).Value) = CName Then
        If Trim(objSheet.cells(row, 6)) = "CHANGED" Then
            objExcel.ActiveWorkbook.Close
            WScript.quit
        Else
            objSheet.cells(row, 6) = "CHANGED"
            objSheet.cells(row, 7) = Trim(CStr(Now))
            newName = Trim(objSheet.cells(row, 5).Value)
            Exit Do
        End If
    End If
row = row + 1
Loop

If newName = "" Then
    objExcel.ActiveWorkbook.Close
    WScript.quit
End If

objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close

sNewName = newName

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
'.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With

a = MsgBox("Your computer name has been successfully changed to " + sNewName, vbInformation)
0
 

Author Comment

by:Roebuck1967
ID: 10692837
Thanks, I will try it out on Monday.

0
 

Author Comment

by:Roebuck1967
ID: 10692918
Question:

I assume I can call the vb script from a batch file correct?

What name should the excel spread sheet be?

Should the excel spread sheet reside in the same location as the vb script?

0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10696340
1) Yes, run this the same as the others
2) You can name it anything you like, but be sure to specify the correct name in line 6 (strPathExcel = "c:\CName.xls")
3) Again, the excel file can be located anywhere, but you must specify the full path to the network resource in line 6, along with the name, for example:
    strPathExcel = "\\Server\share\Sheetname.xls"
0
 

Author Comment

by:Roebuck1967
ID: 10697269
YohanShminge

Thanks for ALL your help.  I will test this out on Monday and let you know my results
0
 

Author Comment

by:Roebuck1967
ID: 10703705
YohanShminge

The script runs but the computer name is not changing.
- Not receiving message “Your computer name has been successfully changed to”
- Excel is not installed on the server but is on the client
In the spreadsheet
  Column A = Old Computer name
  Column B = Blank
  Column C = Users Name
  Column D = Blank
  Column E  = New Computer name

Script looks like this:

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, strCN
Dim objFile, strGuyFile, intRow

Set objNet = CreateObject("WScript.NetWork")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

CName = Trim(objNet.ComputerName)
row = 1

newName = ""

Do While Trim(objSheet.cells(row, 1).Value) <> ""
    If Trim(objSheet.cells(row, 1).Value) = CName Then
        If Trim(objSheet.cells(row, 6)) = "CHANGED" Then
            objExcel.ActiveWorkbook.Close
            WScript.quit
        Else
            objSheet.cells(row, 6) = "CHANGED"
            objSheet.cells(row, 7) = Trim(CStr(Now))
            newName = Trim(objSheet.cells(row, 5).Value)
            Exit Do
        End If
    End If
row = row + 1
Loop

If newName = "" Then
    objExcel.ActiveWorkbook.Close
    WScript.quit
End If

objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close

sNewName = newName

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
'.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With

a = MsgBox("Your computer name has been successfully changed to " + sNewName, vbInformation)


0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10703845
Does it give any error messages?  I assume you're running it on the clients to test? Not on the server? If run on the server, it will stop at the Excel part, since Excel is not installed locally.
0
 

Author Comment

by:Roebuck1967
ID: 10703880
No error messages.  Testing from a test box.  The script and excel spreadsheet are on the Domain Controller
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10703912
OK, and the test box has Excel I assume?  Try this script and tell me what messages pop up (write them down, there could be as many as 9).  Also, make sure that the name in column A is different from the name in column B for this computer, and that this computers name is PRESENT in column A:

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, strCN
Dim objFile, strGuyFile, intRow

Msgbox("Point 1")
Set objNet = CreateObject("WScript.NetWork")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Msgbox("Point 2")
CName = Trim(objNet.ComputerName)
row = 1

newName = ""

Msgbox("Point 3")
Do While Trim(objSheet.cells(row, 1).Value) <> ""
    If Trim(objSheet.cells(row, 1).Value) = CName Then
        If Trim(objSheet.cells(row, 6)) = "CHANGED" Then
            objExcel.ActiveWorkbook.Close
            Msgbox("Already Changed")
            WScript.quit
        Else
            objSheet.cells(row, 6) = "CHANGED"
            objSheet.cells(row, 7) = Trim(CStr(Now))
            newName = Trim(objSheet.cells(row, 5).Value)
            Msgbox("Point CHANGENAME FOUND Name: " + newName)
            Exit Do
        End If
    End If
row = row + 1
Loop

Msgbox("Point 4")
If newName = "" Then
    objExcel.ActiveWorkbook.Close
    WScript.quit
End If

Msgbox("Point 5")
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close

Msgbox("Point 6")
sNewName = newName

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
Msgbox("Point 7")
With oShell
'.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With

a = MsgBox("Your computer name has been successfully changed to " + sNewName, vbInformation)
0
 

Author Comment

by:Roebuck1967
ID: 10704077
Test box has excel installed
This is what I receive:

Pop up Box    Option
-----------------------------------
1 - Point 1     (select Ok)
2 - Point 2     (select Ok)
3 - Point 3     (select Ok)
4 - Point 3     (select Ok)
-----------------------------------

pops up 4 times
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10704128
OK, this indicates to me that the program is not finding the computer's name in the excel sheet.  Try going through the sheet to make sure that this computer's name is listed in column A.  It would appear from the messages that it is not.  Another thing that could cause the problem is if you have blank rows anywhere before the end of the list.  The program stops moving through column A if it hits a blank cell.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10704152
For the fourth pop up box, you meant 4 - Point 4    (select Ok) right?
0
 

Author Comment

by:Roebuck1967
ID: 10704260
OK this is what I did.  The list has 420 names - I moved my test machine to the top of the list in column A.
made sure no blank rows existed.
Received the same 4 popup messages as above.
Computer name is still the same.
Should my columns have titles/labels?
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10704305
No, there should be no titles/labels.  I forgot to take into account the case of the computer name.  Perhaps they are different.  Try this and tell me what happens:

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, strCN
Dim objFile, strGuyFile, intRow

Msgbox("Point 1")
Set objNet = CreateObject("WScript.NetWork")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Msgbox("Point 2")
CName = Trim(objNet.ComputerName)
row = 1

newName = ""

Msgbox("Point 3 - Current Name: " + CName)
Do While Trim(objSheet.cells(row, 1).Value) <> ""
    If UCase(Trim(objSheet.cells(row, 1).Value)) = UCase(CName) Then
        If Trim(objSheet.cells(row, 6)) = "CHANGED" Then
            objExcel.ActiveWorkbook.Close
            Msgbox("Already Changed")
            WScript.quit
        Else
            objSheet.cells(row, 6) = "CHANGED"
            objSheet.cells(row, 7) = Trim(CStr(Now))
            newName = Trim(objSheet.cells(row, 5).Value)
            Msgbox("Point CHANGENAME FOUND Name: " + newName)
            Exit Do
        End If
    End If
row = row + 1
Loop

Msgbox("Point 4")
If newName = "" Then
    objExcel.ActiveWorkbook.Close
    WScript.quit
End If

Msgbox("Point 5")
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close

Msgbox("Point 6")
sNewName = newName

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
Msgbox("Point 7")
With oShell
'.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With

a = MsgBox("Your computer name has been successfully changed to " + sNewName, vbInformation)
0
 

Author Comment

by:Roebuck1967
ID: 10704401
1 - Point 1 (select Ok)
2 - Point 2 (select Ok)
3 - Point 3 "Current Name: TestAD" (select Ok)
4 - Point 4 "CHANGENAME FOUND Name: TAKING-Test01" (select Ok)
5 - Pount 4 (select Ok)
6 - Pount 6 (select Ok)
7 - Pount 7 (select Ok)
Your computer name has been succsssfully changed to TAKING-Test01

computer name was indeed changed
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10704427
Excellent!  It must have been that the cases were different.  It just set them both to all uppercase to do the compare.
0
 

Author Comment

by:Roebuck1967
ID: 10704450
Next dilemma:
How do we eliminate all the error “point” messanges?
Since the computer name changed its no longer a recognized name on the network – any way the script could add it to the network and removed if possible the old name
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10704466
YohanShminge, I enjoy watching the evolution of your script.  It has been a good training example.

Thanks.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10704470
Here it is without the messages.  What do you mean by "its no longer a recognized name on the network"?  Are you talking about AD?  If so, I'm not sure I can help with that...

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, strCN
Dim objFile, strGuyFile, intRow

Set objNet = CreateObject("WScript.NetWork")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

CName = Trim(objNet.ComputerName)
row = 1

newName = ""

Do While Trim(objSheet.cells(row, 1).Value) <> ""
    If UCase(Trim(objSheet.cells(row, 1).Value)) = UCase(CName) Then
        If Trim(objSheet.cells(row, 6)) = "CHANGED" Then
            objExcel.ActiveWorkbook.Close
            WScript.quit
        Else
            objSheet.cells(row, 6) = "CHANGED"
            objSheet.cells(row, 7) = Trim(CStr(Now))
            newName = Trim(objSheet.cells(row, 5).Value)
            Exit Do
        End If
    End If
row = row + 1
Loop

If newName = "" Then
    objExcel.ActiveWorkbook.Close
    WScript.quit
End If

objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close

sNewName = newName

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
'.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With

a = MsgBox("Your computer name has been successfully changed to " + sNewName, vbInformation)
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10704475
Thanks RDAdams!
0
 

Author Comment

by:Roebuck1967
ID: 10704478
since the name is removed for the domain it cannot logon on the domain.  It has no domain affiilitation.
0
 

Author Comment

by:Roebuck1967
ID: 10704486
RDAdams

YohanShminge is tops in my book
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10704499
Are you saying the new computer name assigned cannon logon to the domain?
0
 

Author Comment

by:Roebuck1967
ID: 10704552
That is correct


Error at logon says "systems computer account in its primary domain is missing or the password on the account is incorrect "
0
 

Author Comment

by:Roebuck1967
ID: 10705134
Any luck?
0
 

Author Comment

by:Roebuck1967
ID: 10706434
Calling Dr. YohanShminge
0
 

Author Comment

by:Roebuck1967
ID: 10706435
Calling Dr. YohanShminge
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10707691
Hello everyone! I'm back! Wow, I think I've been having computer withdraw! ;-) So though I have no experience with the Active Directory, I may still be able to help.  I've heard good things about the "Active Directory Cookbook" and I found a script to add a computer to AD.  You'll have to fill in the stuff I don't know, but here is the code (not the ***********s):

-------------------------------------------------------

' From the book "Active Directory Cookbook" by Robbie Allen
' This VBScript code creates a computer object.
' ------ SCRIPT CONFIGURATION ------
Dim strComp
Set objNet = CreateObject("WScript.NetWork")

strBase = "<ParentComputerDN>"  '  **********I don't know what CN and DC are...hopfully you do! EX: cn=Computers,dc=rallencorp,dc=com

strComp = Trim(objNet.ComputerName) ' *********The computer name to be added

strDescr = ""      ' **********Enter a description for the computer here if you like!
' ------ END CONFIGURATION ---------

' ADS_USER_FLAG_ENUM
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000

set objCont = GetObject("LDAP://" & strBase)
set objComp = objCont.Create("computer", "cn=" & strComp)
objComp.Put "sAMAccountName", strComp & "$"
objComp.Put "description", strDesc
objComp.Put "userAccountControl", ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComp.SetInfo
Wscript.Echo "Computer account for " & strComp & " created"

0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10707698
Try that out by itself, and if it works, Ill add it into the main script.  Then I'll have to try and find a way to remove the old computer names.
0
 

Author Comment

by:Roebuck1967
ID: 10707975
Does this look right?

---------------------------------------------------------------------------------------------------------

Dim strComp
Set objNet = CreateObject("WScript.NetWork")

strBase = "<Would this be my Domain Name?>"  ' <-----------------------------------------------------

strComp = Trim(objNet.Taking-Test)

strDescr = "Test Computer"      ' **********Enter a description for the computer here if you like!
' ------ END CONFIGURATION ---------

' ADS_USER_FLAG_ENUM
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000

set objCont = GetObject("LDAP://" & strBase)
set objComp = objCont.Create("computer", "cn=" & strComp)
objComp.Put "sAMAccountName", strComp & "$"
objComp.Put "description", strDesc
objComp.Put "userAccountControl", ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComp.SetInfo
Wscript.Echo "Computer account for " & strComp & " created"
0
 

Author Comment

by:Roebuck1967
ID: 10708014
Also the domain controller is NT4 - we are not fully AD yet

Rather like this:

-----------------------------------------------------------------------
Dim strComp
Set objNet = CreateObject("WScript.NetWork")

strBase = "<Would this be my Domain Name?>"  ' <-----------------------------------------------------

strComp = Trim(objNet.Taking-Test)  <-----------------------------------------------------

strDescr = "Test Computer"   <-----------------------------------------------------
' ------ END CONFIGURATION ---------

' ADS_USER_FLAG_ENUM
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000

set objCont = GetObject("LDAP://" & strBase)
set objComp = objCont.Create("computer", "cn=" & strComp)
objComp.Put "sAMAccountName", strComp & "$"
objComp.Put "description", strDesc
objComp.Put "userAccountControl", ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComp.SetInfo
Wscript.Echo "Computer account for " & strComp & " created"
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10708055
This line: strComp = Trim(objNet.Taking-Test)
Should be: strComp = "Taking-Test"

As for strBase, the example they gave was "cn=Computers,dc=rallencorp,dc=com" ... I was hoping you would know how to interpret this - something to do the AD, like the different catagories or something.

You say you're not fully AD? This script is for the Active Directory, so it might not work right.
0
 

Author Comment

by:Roebuck1967
ID: 10708201
Ran the script and getting an error at line 15 Char 1  Saying the server is not operational


Dim strComp
Set objNet = CreateObject("WScript.NetWork")

strBase = "<kcrg.com>"

strComp = "Taking-Test"

strDescr = "Test Computer"  

' ------ END CONFIGURATION ---------

' ADS_USER_FLAG_ENUM
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000

set objCont = GetObject("LDAP://" & strBase)
set objComp = objCont.Create("computer", "cn=" & strComp)
objComp.Put "sAMAccountName", strComp & "$"
objComp.Put "description", strDesc
objComp.Put "userAccountControl", ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComp.SetInfo
Wscript.Echo "Computer account for " & strComp & " created"
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10708255
Yes, this must be because you're not running AD.  Can you describe exactly what you're using.  Do you know of any way to do this from the command line?
0
 

Author Comment

by:Roebuck1967
ID: 10708301
-Clients including test pc are all Windows 2000
-Domain Controller is Windows NT

No sure how to get around this via command line.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10708511
On your NT domain controller, perhaps you have the file, "netdom.exe" ?  What do you think of this: http://www.tburke.net/info/suptools/topics/netdom.htm
0
 

Author Comment

by:Roebuck1967
ID: 10708539
Sounds good as long as it works and does not to any damage.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10708679
I hope not!  Could you experiment with netdom and see if you can figure out the syntax it requires?
0
 

Author Comment

by:Roebuck1967
ID: 10709103
When running the Netdom - I'm able to add the computer to the domain but receive an error referencing the second line in the script below
(system cannon find path)


NETDOM ADD /d:kcrg.com Test01
/ud:kcrg.com\adminaccount /pd:*************
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10709684
I believe those two should be on the SAME line in your BAT file, like this: NETDOM ADD /d:kcrg.com Test01 /ud:kcrg.com\adminaccount /pd:*************

Question: Is the netdom.exe file located on your win2k machines or only on the server?  If its only on the server, you could probably copy it to a shared folder, then you could add that line to a batch file, or to a VB script.  Is there also a NETDOM DELETE function? I assume you want to remove the old computer name...
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10709692
The only problem with this is that you have put your administrative password out in the vbscript for anyone to read.  Perhaps you could create a separate domain admin account only for use in the script.
0
 

Author Comment

by:Roebuck1967
ID: 10709821
I was thinking the exact same thing.  The script will only run for a week then I can delete the account
There is a NETDOM REMOVE function that removes the computer fomr the domain.

I will try the same line option tomorrow and let you know.

THANKS for alll your help..If you every in Philly lunch is on me.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10709901
I'm always glad to help!  I hope to get a job doing this someday, but for now, its EE. ;-)
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:Roebuck1967
ID: 10712972
Receive this error when running the command from the same line

Multiple connections to a server or shared resource by the same user, using more
 than one user name, are not allowed. Disconnect all previous connections to the
 server or shared resource and try again..
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10713244
On which computer? Have you disconnected any shares?
0
 

Author Comment

by:Roebuck1967
ID: 10713261
From my workstation
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10713368
So your workstation was probably already part of the domain, right?  You probably cannot run that command multiple times.
0
 

Author Comment

by:Roebuck1967
ID: 10713395
are you saying that I sould run it from a pc that is not part of the domain.  The pc I'm adding from the script is not part of the domain, it's just a fictitious name.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10713673
Yeah, I think it will work only when run from a computer that is not part of the domain that has a real name.  If it works under those conditions, we can add it to that script, right after the part with all the registry name changes.
0
 

Author Comment

by:Roebuck1967
ID: 10713822

The first line of the command works as it did before - on the second line I get:
system cannot find path specified
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10713831
Did you try putting them on the same line, like this: NETDOM ADD /d:kcrg.com Test01 /ud:kcrg.com\adminaccount /pd:*************
0
 

Author Comment

by:Roebuck1967
ID: 10713888
almost working -  get this error

The credentials supplied conflict with an existing set of credentials.

The command failed to complete successfully.
0
 

Author Comment

by:Roebuck1967
ID: 10713956
OK -- - - -THAT WORKED - What's the next step?
0
 

Author Comment

by:Roebuck1967
ID: 10714725
Paging Dr.  YohanShminge
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10714784
Could you post the EXACT (remove the passwords of course ;-) syntax of the ADD and REMOVE functions?  Also, is netdom.exe on all of your 2000 machines?
0
 

Author Comment

by:Roebuck1967
ID: 10715212
netdom is not on any of my machines
the command goes as follows:

NETDOM ADD /d:kcrg.com Test-AD /ud:adminaccount /pd:*************
0
 

Author Comment

by:Roebuck1967
ID: 10716713
Any luck?
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10717189
Don't worry, I haven't forgotten!  Here's the script including the netdom command to add computers, but not to remove the old names (edit the second to last line with the proper path to netdom.exe and the appropriate password:

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, strCN
Dim objFile, strGuyFile, intRow

Set objNet = CreateObject("WScript.NetWork")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

CName = Trim(objNet.ComputerName)
row = 1

newName = ""

Do While Trim(objSheet.cells(row, 1).Value) <> ""
    If UCase(Trim(objSheet.cells(row, 1).Value)) = UCase(CName) Then
        If Trim(objSheet.cells(row, 6)) = "CHANGED" Then
            objExcel.ActiveWorkbook.Close
            WScript.quit
        Else
            objSheet.cells(row, 6) = "CHANGED"
            objSheet.cells(row, 7) = Trim(CStr(Now))
            newName = Trim(objSheet.cells(row, 5).Value)
            Exit Do
        End If
    End If
row = row + 1
Loop

If newName = "" Then
    objExcel.ActiveWorkbook.Close
    WScript.quit
End If

objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close

sNewName = newName

Set oShell = CreateObject("WSCript.shell")

sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"

With oShell
'.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With

Set SH = CreateObject("WScript.Shell")
SH.Run "\\SERVERNAME\SHARENAME\NETDOM ADD /d:kcrg.com Test-AD /ud:adminaccount /pd:*************", 0, true

a = MsgBox("Your computer name has been successfully changed to " + sNewName, vbInformation)
0
 

Author Comment

by:Roebuck1967
ID: 10717323
Question

Should I still use Test-AD   (see below)      

SH.Run "\\DS\ADLookup\NETDOM ADD /d:kcrg.com Test-AD /ud:adminaccount /pd:*************", 0, true
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10717371
O yes, i forgot about that! :-D Replace it with this line so it will ad the name it gets from the excel file:

SH.Run "\\SERVERNAME\SHARENAME\NETDOM ADD /d:kcrg.com " + sNewName + " /ud:adminaccount /pd:*************", 0, true
0
 

Author Comment

by:Roebuck1967
ID: 10717736
We are back to square one -
Error at logon says "systems computer account in its primary domain is missing or the password on the account is incorrect "
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10717830
What was the condition of this computer before it was logged in and the script ran?  Part of the domain with an old name? When does this message appear?
0
 

Author Comment

by:Roebuck1967
ID: 10718164
Just a normal domain workstation (part of the domain)
Message appears when I reboot after the name change script runs
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10718273
Did the name change? Did it rejoin the domain?
0
 

Author Comment

by:Roebuck1967
ID: 10718294
Yes the name changed and the new name is part of the domain.
0
 

Author Comment

by:Roebuck1967
ID: 10718391
found this error in the system event log

Event Type:      Error
Event Source:      Service Control Manager
Event Category:      None
Event ID:      7013
Date:            3/30/2004
Time:            4:58:58 PM
User:            N/A
Computer:      TAKING-Test3
Description:
Logon attempt with current password failed with the following error:
The trust relationship between this workstation and the primary domain failed.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
0
 

Author Comment

by:Roebuck1967
ID: 10718591
0
 

Author Comment

by:Roebuck1967
ID: 10718634
For each member, there is a discrete communication channel (that is, the secure channel) with a domain controller. The secure channel is used by the Netlogon service on the member and on the domain controller to communicate. The NETDOM command line utility makes it possible to reset the secure channel of the member.

Suppose you have a domain member named DOMAINMEMBER. You can reset the member secure channel by using the following command:
   NETDOM MEMBER \\DOMAINMEMBER /JOINDOMAIN
                        

You can run the command above on the member DOMAINMEMBER or on any other member or domain controller of the domain, provided that you are logged on with an account that has administrator access to DOMAINMEMBER.

The output received from the command should be similar to the following:
   Searching PDC for domain DOMAIN ...
   Found PDC \\DOMAINPDC
   Querying domain information on PDC \\DOMAINPDC ...
   Querying domain information on computer \\DOMAINMEMBER ...
   Computer \\DOMAINMEMBER is already a member of domain DOMAIN.
   Verifying secure channel on \\DOMAINMEMBER ...
   Verifying the computer account on the PDC \\DOMAINPDC ...
   Resetting secure channel ...
   Changing computer account on PDC \\DOMAINPDC ...
   Stopping service NETLOGON on \\DOMAINMEMBER .... stopped.
   Starting service NETLOGON on \\DOMAINMEMBER .... started.
   Querying user groups of \\DOMAINMEMBER ...
   Adding DOMAIN domain groups on \\DOMAINMEMBER ...

   The computer \\DOMAINMEMBER joined the domain DOMAIN successfully.

   Logoff/Logon \\DOMAINMEMBER to take modifications into effect.

0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10718723
Hmm, so can we include that line in the logon script?  DOMAINMEMBER Refers to the computer name, right?
0
 

Author Comment

by:Roebuck1967
ID: 10718753
Sounds like it
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10719329
Yes, I think so too.  Can you logon to your test computer (the one currently giving the error) using the local Administrator account and try that command, to see if it remedies the problem?
0
 

Author Comment

by:Roebuck1967
ID: 10723907
Found a tool called RENCOMP

RenComp is a command line tool that helps Windows NT/2000 administrators to rename workstations’ names in a domain remotely from their terminal.
USAGE
RenComp.exe TargetComputer NewName
TargetComputer—The current name of the workstation that will be renamed.
NewName—The new name that will be given to the workstation. Should not be longer than 15 characters.
This tool copies itself to the \\TargetComputer\ADMIN$ share and installs itself as a service on the target workstation. Then it starts itself as a service on the workstation to change the name of the workstation and do a hard reboot of the workstation.
If the ADMIN$ share does not exist on the target workstation, then RenComp tries to create it. If the ADMIN$ share didn’t exist prior to the running of RenComp, it is later removed from the workstation.
Only administrators can install services, and therefore, only administrators can run RenComp.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10723948
Wow, does it work?
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10723974
Where did you find the tool RENCOMP?  Is this a commercial tool?
0
 

Author Comment

by:Roebuck1967
ID: 10723994
It allows admins to remotely rename the computers.
0
 

Author Comment

by:Roebuck1967
ID: 10724035
RDAdams someone from my company gave it to me.
basically your run it and once the client reboots their pc is part of the domain with new computer name - it does not remove the old name though and you have to do each pc 1 at a time
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10724048
If you do Help > About does it have a website or manufacturer name?  I would like to take a look at it!
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10724053
Well, each computer has to be physically turned on, and you wouldnt want to do this without warning the computer's user first (which you could do through the "net send" command).  However, once you have that done, its a simple matter of writting a VBscript to loop through that excel sheet and rename all the computers.
0
 

Author Comment

by:Roebuck1967
ID: 10724105
YohanShminge
ok lets give it a shot
0
 

Author Comment

by:Roebuck1967
ID: 10724122
RDAdams

The company is Aleita Software
0
 
LVL 11

Accepted Solution

by:
YohanShminge earned 500 total points
ID: 10724156
OK, lets try this:

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, objFile

Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set SH = CreateObject("WScript.Shell")

row = 1

newName = ""

Do While Trim(objSheet.cells(row, 1).Value) <> ""
   CName = objSheet.cells(row, 1)
   objSheet.cells(row, 6) = "CHANGED"
   objSheet.cells(row, 7) = Trim(CStr(Now))
   newName = Trim(objSheet.cells(row, 5).Value)
   
   SH.Run "RENCOMP " + CName + " " + newName, 0, true

   a = MsgBox("Changed " + CName + " to " + newName + "!", vbInformation)
 
   row = row + 1
Loop

objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10724207
That will loop through all the old names in the sheet and run RENCOMP with the old name and the new name listed in the sheet.  If you don't want to click 420 messageboxes, you could remove the   a = MsgBox("Changed " + CName + " to " + newName + "!", vbInformation) line from the script.  Also, you could change this line:
SH.Run "RENCOMP " + CName + " " + newName, 0, true
To this, to allow you to see what RENCOMP is doing:
SH.Run "RENCOMP " + CName + " " + newName, 1, true
0
 

Author Comment

by:Roebuck1967
ID: 10724261
Where shoud I place RENCOMP.EXe file?
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10724572
Just for anyone else following this discussion, you can download the Domain Migration Resource kit which has the RENCOMP utility as part of the kit from the following website.

http://www.aelita.com
0
 

Author Comment

by:Roebuck1967
ID: 10725131
Almost gave me a heart attack – the script started to go down the lookup chart and rename each machine – I received a pop up confirmation for each one. I stopped it on the 2nd entry.  When the test pc rebooted it had the same old name – It did change one users pc which I will check when she takes her lunch break.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10725363
I'm sorry about that!  So the test machine did NOT get its name changed?  Had you manually changed it back since my original script changed it?  If you terminated that script early, you might have to terminate "EXCEL.EXE" in the processes list of the machine that ran it before it will work again.  As for where to place the RENCOMP file, it should be located in your system directory, or you'll have to specify the entire path.  I'll bet that the script actually DIDNT run RENCOMP, unless you had placed it in one of these locations, and it was just giving the messageboxes.  Try this instead, so you can be sure that rencomp runs:

--------------------------------------------------------------------------------------------------------

Dim objExcel, strPathExcel, objFile

Set objExcel = CreateObject("Excel.Application")
strPathExcel = "\\DS\ADLookup\ADLookupR.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set SH = CreateObject("WScript.Shell")

row = 1

newName = ""

Do While Trim(objSheet.cells(row, 1).Value) <> ""
   CName = objSheet.cells(row, 1)
   objSheet.cells(row, 6) = "CHANGED"
   objSheet.cells(row, 7) = Trim(CStr(Now))
   newName = Trim(objSheet.cells(row, 5).Value)
   
   SH.Run "RENCOMP " + CName + " " + newName, 1, true

   a = MsgBox("Changed " + CName + " to " + newName + "!", vbInformation)
 
   row = row + 1
Loop

objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close
0
 

Author Comment

by:Roebuck1967
ID: 10725421
Thats ok just gave me a scare.  Test machine still have the same name "TestPC"
The RENCOM file is located on the Domain Controller whre my script files are.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10725478
OK, can you move RENCOMP into your windows or system directory?  Then, try to run it manually, without the script, like this:

"RENCOMP TestPC newName"

Replacing newName with the new name for the test PC.  If you can get it to work from DOS, then it should work in the script...
0
 

Author Comment

by:Roebuck1967
ID: 10725630
A few things here:

1) In order to run RENCOMP you must be an administrator

2) RENCOMP will only run from its location - so you can't place it in a windows dir. unless you run it from that location.

3) Once it runs it automatically reboots the pc.


0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10725683
1) Do you mean that the person logged on at the remote computer must be an admin?

2) Thats fine, we'll just specify the full path in the script

3) This is a necessary evil - all you can do is notify the user.
0
 

Author Comment

by:Roebuck1967
ID: 10725737
1 The account that runs the utility mut be an admin

3 Yep....

0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10725825
1) Too bad you demoted all accounts to Power User a couple weeks ago...

Any ideas?
0
 

Author Comment

by:Roebuck1967
ID: 10726160
Nope...they are stilll Admins
0
 

Author Comment

by:Roebuck1967
ID: 10726377
Hey the script that we ran that scared me actually worked on her machine.  Whe she rebooted she was able to login fine with the new computer name.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10726609
Really?  Thats great!  So I guess the only problem is having the computers on and notifying the user.  You could either plan a time after everyone leaves and just tell them to leave their computers on, or we could have the vbscript send a notification via email or the "net send" command...
0
 

Author Comment

by:Roebuck1967
ID: 10726680
Actually the user would not have to know... The last script ran and the user was able to work fine - had no clue the computer name changed.

So if we could get the script to run from my test box - and log the change that would be great.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10726752
Strange...I thought the program would force a hard restart after the name change?

So you want the script to run from your test box?  It should run without any trouble.  It already logs the changes to the excel file in columns F and G, as long as the script completely executes and the excel file is saved and closed.  If you want it to log to a separate text file, that would be fine too!
0
 

Author Comment

by:Roebuck1967
ID: 10726767
Me too - the existing spreadsheet is fine
0
 

Author Comment

by:Roebuck1967
ID: 10726969
Any luck?
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10727585
I lost track of what you want me to do... I thought you were testing on your test box?
0
 

Author Comment

by:Roebuck1967
ID: 10728004
Sorry about the confusion; I have the script running and reduced the lookup table to 6 entries.  It tells me the name was changed even for pc's that are turned off... Not sure why.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10728039
Yeah, I was thinking that RENCOMP would give an error if that happened, but I guess not, so the script just keeps going as if it had worked.  Im not sure if theres a way to get the output from it or not.  Do you know where I could download the program?
0
 

Author Comment

by:Roebuck1967
ID: 10728174
No sure where to download RENCOM software...Wish I could email it to you.
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10728201
Remove spaces and change (at) to @: falcon10 (at) attbi.com
0
 

Author Comment

by:Roebuck1967
ID: 10728929
Thanks, My name is Paul.  I will send you a test from my home account (Verizon)
0
 

Author Comment

by:Roebuck1967
ID: 10732061
YohanShminge

Let close this case and I will give you the Points - We can open a new onw where I can ask some additional questions about this script.  Is that ok?
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10732303
Yes, thats fine - it was getting exceedingly long anyways!
0
 

Author Comment

by:Roebuck1967
ID: 10732314
Did you get my email?
0
 

Author Comment

by:Roebuck1967
ID: 10732335
Started a new continuation of this issue..Look it up when you have a chance
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10732342
Yep
0
 
LVL 11

Expert Comment

by:YohanShminge
ID: 10732346
Will do - you probably know my schedule by now! ;-)
0
 

Author Comment

by:Roebuck1967
ID: 10732363
Yes...I will send the application now from my work email address
0

Featured Post

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Join & Write a Comment

Resolve DNS query failed errors for Exchange
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now