Tag: powershell
Powershell - List Disks with Location, Size and Device ID
by Harry on Apr.08, 2010, under Microsoft
Here is a quick one line powershell command to spit out the Location (port, bus, scsi target id, lun id), size (in GB) and Device ID (also known as disk number in the windows gui) into a file.
Get-WmiObject Win32_DiskDrive | select-object DeviceID,{$_.size/1024/1024/1024},scsiport,scsibus,scsitargetid,scsilogicalunit | out-file -FilePath c:\output.txt
Note: This command is one line, watchout for wordwrap!
Powershell: List NIC with IP, MAC and Description
by Harry on Mar.26, 2010, under Development, Microsoft
Hi Y’all, Just a quick entry for list the IP, MAC and Description fields of the NIC that are IP enabled on a system using Powershell. Might be handy for when the network team asks for MAC addresses to trace ports.
Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “TRUE”} | Select-Object MACAddress,caption,description,IPAddress
Note: This command is all on one line, so beware of the word wrapping.
Update: this one is little better, it gets the network connection name as seen by Network Connections Window
Get-WmiObject win32_networkadapter | where {$_.physicaladapter -eq $true} | Select-Object macaddress,netconnectionid
Powershell tip - WMI Classes
by Harry on Sep.07, 2009, under Development, Microsoft
Here is a quick tip on how to find a WMI Class using powershell based on a keyword
get-wmiobject -list | select-string “keyword”