No Get-InstanceID in Powershell 3.0

Hello everyone! Happy Wednesday!

I have noticed around the forums and some replies I have gotten on some of my personal powershell issues that a command “Get-InstanceID” exists.
I tried using this cmdlet myself to no avail…I have read that this cmdlet was introduced in 3.0…yet I in fact have powershell 3.0.

It seems that my powershell doesn’t have this command!

What could the issue be?

Thanks for your time

I’m not familiar with the command, but most commands are not native to PowerShell. They are added in, usually as modules. That is almost always true when they relate to some external product. For example, Get-ADUser is not a native Windows PowerShell command; it comes with specific versions of the Windows operating system.

I assume you’re referring to this thread:

Get-InstanceID is a function whose code I posted in that forum thread. You would need to add it to your script, profile, or to a module:

function Get-InstanceID
    param (
        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
        foreach ($id in $EventID)
            $maskedId = $id -band 0x3FFFFFFF
            $maskedId -bor 0x40000000L
            $maskedId -bor 0x80000000L
            $maskedId -bor 0xC0000000L

Oh, so you are creating the function with that code! Now I get it! I should of read the help on “function”. I should of known this!

Taken from the Learn Windows Powershell in a Month of Lunches book (second edition), page 38 Chapter 4

     "A function can be similar to a cmdlet, but rather than being written in a .NET language, functions are written in PowerShell's own scripting language."

This answers my question! Thanks guys!