powershell脚本之-AD域内查询网卡ipv4地址
作者:互联网
#Get-ipv4.ps1 <# .Synopsis Get physical adapters network ipv4 .Description Display all physical adapters from the ipconfig. .Parameter Computername The name of the computer to check. .Example c:\get-ipv4.sp1 -computer SERVER01 #> [cmdletbinding()] Param ( [Parameter(Mandatory=$True,HelpMessage="Enter a computername to query")] [alias('hostname')] [string]$Computername ) Write-Verbose "Getting physical network adapters ipv4 from $computername" -Verbose Invoke-Command -ComputerName $computername -ScriptBlock {Write-Verbose "本机ipv4地址 $computername" -Verbose $ipconfig = ipconfig $ipconfig -match 'ipv4* ' Write-Verbose "ipv4查询成功,15秒退出" -Verbose sleep -s 15}
演示效果
PS C:\> .\ipv4.ps1 cp202007 详细信息: Getting physical network adapters ipv4 from cp202007 详细信息: 本机ipv4地址 IPv4 Address. . . . . . . . . . . : 172.30.33.66 详细信息: 查询成功,15秒退出
标签:Write,computername,15,Verbose,ipconfig,网卡,ipv4,AD 来源: https://blog.51cto.com/jameszhan/2800116