SQL version determination, Powershell function example
This commit is contained in:
24
PowerShell/function_example_Get-MacAddress.ps1
Normal file
24
PowerShell/function_example_Get-MacAddress.ps1
Normal 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 }
|
||||
}
|
Reference in New Issue
Block a user