ahmtech123
MIS
Hi is it possible to display the ip address of a machine under a icon like the my computer icon using vbscript?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'==========================================================================
'
' NAME: Rename MyComputer icon with IP Address.
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.TheSpidersParlor.com[/URL]
' COPYWRITE (c) 2005 All Rights Reserved
' DATE : 8/24/2005
'
' COMMENT: Determines current DHCP IP Address of computer
' Assumes that there is only ONE active NIC.
' then sets that as the name for My Computer
'==========================================================================
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
Set WSHShell = CreateObject("Wscript.Shell")
strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
DHCPAddress = WSHShell.RegRead("HKLM\" & strKeyPath & subkey & "\DhcpIPAddress")
If DHCPAddress <> "0.0.0.0" And Left(DHCPAddress,3) <> "169" Then
ActiveDHCPIPAddress = DHCPAddress
End If
Next
'This will rename the My Computer icon with the computer name
MCPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
WSHShell.RegWrite MCPath & "\", ActiveDHCPIPAddress, "REG_SZ"