Progged programming site

Programming source code, articles, tutorials, links and chat

Display network information using Powershell

 This example will display various snippets of network related information using Powershell
Cls
$strComputer = “.”
$colItems = get-wmiobject -class “Win32_NetworkAdapterConfiguration” `
-computername $strComputer | Where{$_.IpEnabled -Match “True”}
foreach ($objItem in $colItems)
{
write-host “MAC Address : ” $objItem.MACAddress
write-host “IPAddress : ” $objItem.IPAddress
write-host “DNS Servers : ” $objItem.DNSServerSearchOrder
Write-host “”
}

Bookmark It

Hide Sites

[ Back to top ]

Windows XP serial number

This example will display your Windows XP serial number in a text box.
‘add a textbox caled TextBox1 to a form
Sub WindowsSerial()
strComputer = “.”
Set objWMIService = GetObject(”winmgmts:\\” & strComputer & “\root\cimv2″)
Set colItems = objWMIService.ExecQuery(”Select * from Win32_OperatingSystem”, , 48)
For Each objItem In colItems
Text1.Text = objItem.SerialNumber
Next
End Sub
Private Sub Form_Load()
WindowsSerial
End Sub

Bookmark It

Hide Sites

[ Back to top ]

Sponsors