No Get-InstanceID in Powershell 3.0

Welcome Forums General PowerShell Q&A No Get-InstanceID in Powershell 3.0

This topic contains 3 replies, has 3 voices, and was last updated by

4 years, 6 months ago.

  • Author
  • #18477

    Points: 0
    Rank: Member

    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

  • #18478

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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.

  • #18479

    Points: 0
    Rank: Member

    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
  • #18485

    Points: 0
    Rank: Member

    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!

The topic ‘No Get-InstanceID in Powershell 3.0’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort