After reading around, I'm confused about the relationship between these. I don't believe gwmi
is a pure alias for Get-WmiObject
, as they seem to share similar but not identical syntax in the examples I've seen.
Interestingly enough, when I google "gwmi" on its own, all the top references immediately refer back to Get-WmiObject
but don't seem to reference gwmi
itself.
Get-WmiObject is formatting its output as a list, while Get-CimInstance is displaying its output in table form. The actual information that is being displayed is mostly the same. This isn't to say that there are no differences between the two cmdlets.
The Get-WmiObject cmdlet gets instances of WMI classes or information about the available WMI classes. To specify a remote computer, use the ComputerName parameter. If the List parameter is specified, the cmdlet gets information about the WMI classes that are available in a specified namespace.
For a WMI connection to succeed, the remote computer must permit incoming network traffic on TCP ports 135, 445, and additional dynamically assigned ports between 1024 to 1034.
The Get-CimInstance cmdlet gets the CIM instances of a class from a CIM server. You can specify either the class name or a query for this cmdlet. This cmdlet returns one or more CIM instance objects representing a snapshot of the CIM instances present on the CIM server.
There is no fancy voodoo at work here. Aliases in PowerShell are a very simple mechanic that help with short hand coding. Unix aliases, on the other hand, are different and can include entire command calls (Which could possibly be a source of confusion?).
In all cases, there is nothing more that just what you see here from Get-Alias
PS C:\Users\Bagel> get-alias gwmi
CommandType Name ModuleName
----------- ---- ----------
Alias gwmi -> Get-WmiObject
If you have evidence to the contrary I am sure the community would love to see it!
The authoritative reference you need to clear this up is about_Aliases:
An alias is an alternate name or nickname for a cmdlet or for a command element, such as a function, script, file, or executable file. You can use the alias instead of the command name in any Windows PowerShellcommands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With