SQL version determination, Powershell function example

This commit is contained in:
Floris van Enter
2017-11-30 15:49:07 +01:00
parent 77eb6cf2e3
commit 9f918ead05
2 changed files with 658 additions and 0 deletions

View File

@ -0,0 +1,24 @@

function Get-MACAddress {
<#
.SYNOPSIS
Retrieves MAC-Address
.DESCRIPTION
Retrieves MAC-Address from each IP enabled networkdevice in a computer
.PARAMETER ComputerName
The name of the computer to query.
.EXAMPLE
.\Get-MacAddress -ComputerName 'desktop1'
.EXAMPLE
.\Get-MacAddress -ComputerName 'server1','server2','desktop1'
#>
[CmdletBinding()]
Param(
  [Parameter(Mandatory=$True,
ValueFromPipeline=$True)]
  $ComputerName
)
$ComputerName | Foreach { Get-WmiObject -Class "Win32_NetworkAdapterConfiguration" -ComputerName $_.ToString() | Where { $_.IPEnabled -eq $True } | Select PSComputerName, MACAddress, Description }
}