WMI

Sometimes it’s useful to know the computer name and domain you are working on. More than once I had to google for these commands because I just can’t keep them in mind, so I decided to write a quick post as a reminder. The following are my favorites.

PowerShell

1

2

3

"$env:COMPUTERNAME.$env:USERDNSDOMAIN"

Get-WmiObjectWin32_ComputerSystem

The first one returns the FQDN of the computer on the format whereas the second one returns a list of information about the computer such as NETBIOS name (that could be different from the DNS name), domain name, phisical memory, etc… You can also select single properties, changing the cmdlet this way: