get-wmiobject -class win32_service -namespace "root\cimv2" | format-list * enter> 查看机器信息
$name="."
$items = get-wmiObject -class win32_NetworkAdapterConfiguration '
-namespace "root\CIMV2" -ComputerName $name | where{$_.IPEnabled -eq “True”}
foreach($obj in $items) {
Write-Host "DHCP Enabled:" $obj.DHCPEnabled
Write-Host "IP Address:" $obj.IPAddress
Write-Host "Subnet Mask:" $obj.IPSubnet
Write-Host "Gateway:" $obj.DefaultIPGateway
Write-Host "MAC Address:" $ojb.MACAddress
}
$name=read-host "Enter Computer Name"
write-host "Computer:"$name
$items = get-wmiObject -class win32_NetworkAdapterConfiguration '
-namespace "root\CIMV2" -ComputerName $name | where{$_.IPEnabled -eq “True”}
foreach($obj in $items) {
Write-Host "DHCP Enabled:" $obj.DHCPEnabled
Write-Host "IP Address:" $obj.IPAddress
Write-Host "Subnet Mask:" $obj.IPSubnet
Write-Host "Gateway:" $obj.DefaultIPGateway
Write-Host "MAC Address:" $ojb.MACAddress
}