Progged programming site

Programming source code, articles, tutorials, links and chat

Archive for the 'Powershell' Category

file exists

This will display if a file exists using Powershell

$file = Dir $env:windir\explorer.exe $file.Exists
Which will display true if explorer exists

Bookmark It

Hide Sites

[ Back to top ]

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 ]

Sponsors