Advertisement
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 12/06/2007 at 12:09AM PST, ID: 23005396 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: |
=====Script=====Displays Computer Name
Option Explicit
Dim Text, Title
Dim WshNetwork ' Object variable
Text = "Networking information" & vbCrLf & vbCrLf
Title = "Rename Hostname?"
' Create a new WshNetwork object to access network properties.
Set WshNetwork = WScript.CreateObject("WScript.Network")
Text = Text & "Computer name : " & WshNetwork.ComputerName & vbCrLf
Text = Text & "Domain : " & WshNetwork.UserDomain & vbCrLf
Text = Text & "User name : " & WshNetwork.UserName & vbCrLf
MsgBox Text, vbYesNo + vbQuestion, Title
=====End=====
=====Script=== Prompting user to rename or not
strComputerName = InputBox("Enter a new machine name for this computer:", "Rename Computer")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery ("Select Name from Win32_ComputerSystem")
For Each objComputer in colComputers
intErrorCode = objComputer.Rename(strComputerName)
If intErrorCode <> 0 Then
MsgBox "Error renaming computer. Error # " & intErrorCode
Else
Set objOutputFile = objFSO.CreateTextFile(strRenameFlag, True)
objOutputFile.Close
Set objOutputFile = Nothing
MsgBox "Computer renamed. It will now reboot."
objShell.Run "rundll32 shell32.dll,SHExitWindowsEx 2", 1, False
End If
Next
=====Exit=====
|