Computer Name in vbs

Source: Internet
Author: User

Http://www.opencjk.org /~ Scz/

Discussion on computer names

Http://www.opencjk.org /~ Scz/windows/200603151441.txt

Q: My computer-> properties-> computer name-> computer description. I want to change it here, but it is gray and cannot be written.

A: If the lanmanserver service is not enabled, this will happen. Run "net start srv.

Q: I want to modify the Working Group, but it cannot be written in gray.

A: If the lanmanworkstation service is not enabled, this will happen. Run "net start rdr.

Q: How can I modify the computer name on the command line?

A: backend @ nsfocus

--------------------------------------------------------------------------
Set obj = getobject ("winmgmts: \. \ root \ cimv2 ")
Set list = obj.exe cquery ("select * from win32_computersystem ")
For each x in list
X. rename (wscript. arguments. item (0 ))
Next
--------------------------------------------------------------------------

> Cscript.exe // nologo computerrename. vbs xxx

D: scz @ nsfocus

The computer name used by natural language is very inaccurate. The following describes the related registry items precisely:

--------------------------------------------------------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ComputerName \ ActiveComputerName]
"ComputerName" = "CLOUDSKY"

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ComputerName]
"ComputerName" = "CLOUDSKY"

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters]
"Domain" = ""
"Hostname" = "CLOUDSKY"
"NV Domain" = ""
"NV Hostname" = "CLOUDSKY"
--------------------------------------------------------------------------

The ComputerName at ActiveComputerName corresponds to the current NetBIOS name. Another ComputerName will
It is copied to ActiveComputerName at the next restart.

"<Hostname>. <Domain>" corresponds to the current FQDN (full name Domain name), "<NV Hostname>. <NV Domain>"
It is copied to "<Hostname>. <Domain>" at the next restart.

Obviously, we have two types of names: NetBIOS and FQDN,
Although most of the time they are consistent. NetBIOS names are available in many places, suitable for TCP/IP, IPX/SPX,
NetBEUI implements communication protocols for NetBIOS interfaces. FQDN is only used for TCP/IP protocol. Microsoft name resolution
The name resolution sequence varies many times, so it is difficult for end users to distinguish between NetBIOS names and
FQDN. For example, "ping <name>" has multiple variants that depend on the operating system and network.
Topology, which is not discussed in detail here. Remember that there are two computer names.

When modifying a computer name on the GUI, the actual operations are as follows:

--------------------------------------------------------------------------
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ComputerName]
"ComputerName" = "CLOUDSKY"

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters]
"NV Domain" = ""
"NV Hostname" = "CLOUDSKY"
--------------------------------------------------------------------------

Now you should understand why it takes effect after you modify the computer name on the GUI and restart it.

Generally, you are not recommended to directly modify these values in the registry. You can consider Win32 API. SetComputerName () only
The NetBIOS name can be set. SetComputerNameEx () can be used to set the NetBIOS name or FQDN.

You can also use WMI, as demonstrated by backend. This method is equivalent to the GUI modification method.
The NetBIOS Name and FQDN have been changed and will take effect after restart. Note: These two methods are automatically transferred when NetBIOS name is modified.
Replace it with uppercase, while FQDN is case sensitive.

Observe hostname.exe using the register table, and you will find that this command only takes the Hostname in the FQDN, not
Take the NetBIOS name. "Nbtstat-A <target>" is the NetBIOS name. What devmgmt. msc obtains is
The NetBIOS name at ActiveComputerName.

If HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ComputerName is damaged,
Check the NetBIOS name on my computer. It may be blank. In this case, access "\ <ip> \ ipc $" may cause an error.
The error message is useless. No IP packet is found during packet capture. The error level is high and the packet has not arrived.
IP layer. Access to "\ <name> \ ipc $" is successful. Flier has encountered this kind of problem. It should be the installation of a software.
You can directly modify the computer name in the registry.

Q: Open disk management in XP and report "RPC service unavailable ".

A:

This is where the computer name and ActiveComputerName used by the "Logical Disk Manager/dmserver" Service
The NetBIOS name does not match. This is generally because the latter is damaged. If the OS cannot be restored after it is restarted, please
You can reset the computer name on the GUI. See:

Http://support.microsoft.com/kb/884564

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.