This is what I used -
param(
[parameter(ValueFromPipeline=$TRUE)]
[String[]] $ComputerName=$Env:COMPUTERNAME,
[System.Management.Automation.PSCredential] $Credential
)
begin {
$PipelineInput = (-not $PSBOUNDPARAMETERS.ContainsKey("ComputerName")) -and (-not $ComputerName)
# Outputs the computer name, IP address, and DNS and WINS settings for
# every IP-enabled adapter on the specified computer that's configured with
# an IPv4 address.
function Get-IPInfo($computerName) {
$params = @{
"Class" = "Win32_NetworkAdapterConfiguration"
"ComputerName" = $computerName
"Filter" = "IPEnabled=True"
}
if ( $Credential ) { $params.Add("Credential", $Credential) }
get-wmiobject @params | foreach-object {
foreach ( $adapterAddress in $_.IPAddress ) {
if ( $adapterAddress -match '(\d{1,3}\.){3}\d{1,3}' ) {
foreach ( $dnsServerAddress in $_.DNSServerSearchOrder ) {
new-object PSObject -property @{
"ComputerName" = $_.__SERVER
"IPAddress" = $adapterAddress
"DNSServer" = $dnsServerAddress
} | select-object ComputerName,IPAddress,DNSServer
}
}
}
}
}
}
process {
if ( $PipelineInput ) {
Get-IPInfo $_
}
else {
$ComputerName | foreach-object {
Get-IPInfo $_
}
}
}
Best casino bonus codes 2021 - CasinoWow
ReplyDeleteTop Online Casino Bonuses for 2021 · 1. febcasino Spin for Free · 2. 1xBet 1xbet korean Casino Bonus · 3. Virgin Casino 인카지노 Bonus · 4. Bovegas Casino Bonus · 5. Bovada