在桌面显示IP与主机名
1、请将下述代码存在VBS格式:
Dim ip
Dim Mac
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress,MacAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
ip = IPConfig.IPAddress(i)
Mac = IPConfig.MacAddress
Next
End If
Next
Const ForWriting = 8
Set lei2=WScript.CreateObject("WScript.Network")
CN=lei2.computername
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "BuildLab"
strValue = "( "&CN&" )"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName = "DWORD Value Name"
dwValue = 82
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "CSDVersion"
strValue = ip & " ) ( "& Mac
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName = "DWORD Value Name"
dwValue = 82
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
2、请将下述代码存为BAT格式:
reg add hkcu\Control" "Panel\Desktop /v PaintDesktopVersion /t REG_DWORD /d 1 /f
3、注意点:
1、需要重新启动两次。
2、启动后在登录界面等待15秒以上,再登入。
3、在WIN2000中没有BAT中REG程序,而XP系统中有,如需要在2000域中使用请将REG程序COPY到一个共享目录中,并在BAT代码中加入REG的共享路径。
评论已关闭