Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

$MyInvocation.MyCommand object is set to null when you run the script by using PowerShell 3.0 in Windows 8 or in Windows Server 2012


View products that this article applies to.

Symptoms

Consider the following scenario:
  • You have some custom PowerShell scripts or modules that contain a reference to the built-in $MyInvocation instance.
  • You execute the scripts or modules on a Windows 8-based or Windows Server 2012-based computer by using Windows PowerShell 3.0.
  • Some objects are passed through a pipe.
In this scenario, the value of the $MyInvocation.MyCommand object is set to null.

For example, the issue occurs when you run the following script:
$Line= Get-Content $file
$Line | foreach-Object {
write-host "** MYCOMMAND [2] IS NULL?: " ($MyInvocation.MyCommand -eq $null) " --->" $_
}
Note This issue does not occur when you run the script by using Windows PowerShell 2.0.

↑ Back to the top


Resolution

Hotfix information
A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must be running Windows 8 or Windows Server 2012.

Registry information

To use the hotfix in this package, you do not have to make any changes to the registry.

Restart requirement

You must restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The global version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.





Windows 8 and Windows Server 2012 file information notes
Important Windows 8 hotfixes and Windows Server 2012 hotfixes are included in the same packages. However, only "Windows 8" is listed on the Hotfix Request page. To request the hotfix package that applies to one or both operating systems, select the hotfix that is listed under "Windows 8" on the page. Always refer to the "Applies To" section in articles to determine the actual operating system that each hotfix applies to.
  • The files that apply to a specific product, milestone (RTM, SPn), and service branch (LDR, GDR) can be identified by examining the file version numbers as shown in the following table:

    VersionProductMilestoneService branch
    6.2.920 0.16 xxxWindows 8 and Windows Server 2012RTMGDR
    6.2.920 0.20 xxxWindows 8 and Windows Server 2012RTMLDR
  • GDR service branches contain only those fixes that are widely released to address widespread, critical issues. LDR service branches contain hotfixes in addition to widely released fixes.
  • The MANIFEST files (.manifest) and the MUM files (.mum) that are installed for each environment are listed separately in the "Additional file information for Windows 8 and Windows Server 2012" section. MUM and MANIFEST files, and the associated security catalog (.cat) files, are extremely important to maintain the state of the updated components. The security catalog files, for which the attributes are not listed, are signed with a Microsoft digital signature.
For all supported x86-based versions of Windows 8
File nameFile versionFile sizeDateTimePlatform
System.management.automation.dll6.2.9200.166265,194,75230-May-201300:53x86
System.management.automation.dll6.2.9200.207315,194,75230-May-201306:01x86
For all supported x64-based versions of Windows 8 and of Windows Server 2012
File nameFile versionFile sizeDateTimePlatform
System.management.automation.dll6.2.9200.166265,194,75230-May-201302:50x86
System.management.automation.dll6.2.9200.207315,194,75230-May-201307:54x86

↑ Back to the top


To resolve this issue, install update rollup 2855336, or install the hotfix that is described in this article. This hotfix is also available at Microsoft Update Catalog.

Update information

For more information about how to obtain update rollup 2855336, click the following article number to view the article in the Microsoft Knowledge Base: 
2855336 Windows RT, Windows 8, and Windows Server 2012 update rollup: July 2013



↑ Back to the top


Workaround

To work around this issue, do not use a pipe to pass the objects. For example, you can change the example script to the following:
$Line= Get-Content $file
foreach( $L in $Line){
write-host "** MYCOMMAND [2] IS NULL?: " ($MyInvocation.MyCommand -eq $null) " --->"$L
}

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More Information

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Additional file information

Additional file information for Windows 8 and Windows Server 2012

Additional files for all supported x86-based versions of Windows 8
File nameMsil_system.management.automation_31bf3856ad364e35_6.2.9200.16626_none_996281338d2c68d2.manifest
File versionNot applicable
File size1,718
Date (UTC)30-May-2013
Time (UTC)01:04
PlatformNot applicable
File nameMsil_system.management.automation_31bf3856ad364e35_6.2.9200.20731_none_82964ca5a6d2620a.manifest
File versionNot applicable
File size1,718
Date (UTC)30-May-2013
Time (UTC)06:11
PlatformNot applicable
File nameX86_0069cc1d935f52105e189e37ad3d3c48_31bf3856ad364e35_6.2.9200.16626_none_732d49d23ba3aebb.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_04d1fcf53a2eb0f5a62016f97b15f4ab_31bf3856ad364e35_6.2.9200.16626_none_c69da1ec2767ada5.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_1241b0d382e6bf3603f61b64e9af862f_31bf3856ad364e35_6.2.9200.20731_none_097e5bed0bc97c91.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_14232bfddb283e4092dfb5e467b53539_31bf3856ad364e35_6.2.9200.20731_none_496bd00cd7224620.manifest
File versionNot applicable
File size677
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_18071d4ee234e78661bfb10ae7841e2c_31bf3856ad364e35_6.2.9200.20731_none_3a821365d5cf0b19.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_1b665e9d1198a78d70cb14374324a46a_31bf3856ad364e35_6.2.9200.20731_none_264325cc294b6602.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_3967743f256fb2d2306a18cfc505b75a_31bf3856ad364e35_6.2.9200.16626_none_8d608ec4b43e9639.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_3b47115ead7f971f520a2c1834c813b0_31bf3856ad364e35_6.2.9200.20731_none_fd7012d742e52fd4.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_4af8e3ab66f40e7f6b8757610666efa0_31bf3856ad364e35_6.2.9200.20731_none_94f33e6b74af3453.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_512ded43940eb8acc29e99405fd6830f_31bf3856ad364e35_6.2.9200.16626_none_cef320d83bc0c870.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_5403ff2c90cb7ebccbebf8f061315748_31bf3856ad364e35_6.2.9200.16626_none_5e1e657c1146c0ee.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_686033d3aa0ee13b9a126d9e07846dcc_31bf3856ad364e35_6.2.9200.16626_none_a8095bc0f27be7be.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_7e76fd759f23ee430b19c9c856a9f795_31bf3856ad364e35_6.2.9200.16626_none_36b546445335ce76.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_97174141338aedb98e2288d2de0cf8f3_31bf3856ad364e35_6.2.9200.20731_none_99d384aed8907790.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_9af58ad204db7f5f3bac4409dff8aab7_31bf3856ad364e35_6.2.9200.20731_none_e0fa6c2c89023b18.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_9ef903158e981ef76408781d217dad44_31bf3856ad364e35_6.2.9200.20731_none_aee31af5c7623447.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_aaf311bbeb132fa091936d68798bb2bb_31bf3856ad364e35_6.2.9200.16626_none_6980ebae6781e062.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_b7d70cabd55d7536679e131da2bb22da_31bf3856ad364e35_6.2.9200.16626_none_180d68323a097f3a.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_bf14b3d5846f7c88f4af24011912827c_31bf3856ad364e35_6.2.9200.20731_none_3d4a21756ec54fb9.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_bf9348f555a3a94c1f6c5f0dc95f353b_31bf3856ad364e35_6.2.9200.16626_none_619d841c1882c600.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_ca1bc2fb2ef088a4efd46c51a82bde00_31bf3856ad364e35_6.2.9200.20731_none_ecfd141b9e37f93d.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_cd429c9e15ee381c26a5e0baf4827c83_31bf3856ad364e35_6.2.9200.16626_none_b30938dc97b031b4.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_df0cfec14a8238c163c13c58cc81a786_31bf3856ad364e35_6.2.9200.16626_none_521fa78c897a8660.manifest
File versionNot applicable
File size677
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_df3ebc3a731bf6deb672200943c6478e_31bf3856ad364e35_6.2.9200.20731_none_3bb8c22416c8b2b6.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_e2c64b7dcfafaf4972521c5451fe0969_31bf3856ad364e35_6.2.9200.20731_none_887f185e8a562310.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_eec6c535ad67563dd8b8f6ac043dfe2b_31bf3856ad364e35_6.2.9200.20731_none_f6f2c548ec0797fa.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_f62187109141bad6db8b1238954791e1_31bf3856ad364e35_6.2.9200.16626_none_789c8cd06e1e9b9f.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
File nameX86_f84e3899861bc6b7dd8c4a426046ab50_31bf3856ad364e35_6.2.9200.16626_none_d8d8a6da48df9d24.manifest
File versionNot applicable
File size685
Date (UTC)30-May-2013
Time (UTC)15:28
PlatformNot applicable
Additional files for all supported x64-based versions of Windows 8 and of Windows Server 2012
File nameAmd64_0069cc1d935f52105e189e37ad3d3c48_31bf3856ad364e35_6.2.9200.16626_none_cf4be555f4011ff1.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_04d1fcf53a2eb0f5a62016f97b15f4ab_31bf3856ad364e35_6.2.9200.16626_none_22bc3d6fdfc51edb.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_1241b0d382e6bf3603f61b64e9af862f_31bf3856ad364e35_6.2.9200.20731_none_659cf770c426edc7.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_14232bfddb283e4092dfb5e467b53539_31bf3856ad364e35_6.2.9200.20731_none_a58a6b908f7fb756.manifest
File versionNot applicable
File size679
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_18071d4ee234e78661bfb10ae7841e2c_31bf3856ad364e35_6.2.9200.20731_none_96a0aee98e2c7c4f.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_1b665e9d1198a78d70cb14374324a46a_31bf3856ad364e35_6.2.9200.20731_none_8261c14fe1a8d738.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_3967743f256fb2d2306a18cfc505b75a_31bf3856ad364e35_6.2.9200.16626_none_e97f2a486c9c076f.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_3b47115ead7f971f520a2c1834c813b0_31bf3856ad364e35_6.2.9200.20731_none_598eae5afb42a10a.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_4af8e3ab66f40e7f6b8757610666efa0_31bf3856ad364e35_6.2.9200.20731_none_f111d9ef2d0ca589.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_512ded43940eb8acc29e99405fd6830f_31bf3856ad364e35_6.2.9200.16626_none_2b11bc5bf41e39a6.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_5403ff2c90cb7ebccbebf8f061315748_31bf3856ad364e35_6.2.9200.16626_none_ba3d00ffc9a43224.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_686033d3aa0ee13b9a126d9e07846dcc_31bf3856ad364e35_6.2.9200.16626_none_0427f744aad958f4.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_7e76fd759f23ee430b19c9c856a9f795_31bf3856ad364e35_6.2.9200.16626_none_92d3e1c80b933fac.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_97174141338aedb98e2288d2de0cf8f3_31bf3856ad364e35_6.2.9200.20731_none_f5f2203290ede8c6.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_9af58ad204db7f5f3bac4409dff8aab7_31bf3856ad364e35_6.2.9200.20731_none_3d1907b0415fac4e.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_9ef903158e981ef76408781d217dad44_31bf3856ad364e35_6.2.9200.20731_none_0b01b6797fbfa57d.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_aaf311bbeb132fa091936d68798bb2bb_31bf3856ad364e35_6.2.9200.16626_none_c59f87321fdf5198.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_b7d70cabd55d7536679e131da2bb22da_31bf3856ad364e35_6.2.9200.16626_none_742c03b5f266f070.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_bf14b3d5846f7c88f4af24011912827c_31bf3856ad364e35_6.2.9200.20731_none_9968bcf92722c0ef.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_bf9348f555a3a94c1f6c5f0dc95f353b_31bf3856ad364e35_6.2.9200.16626_none_bdbc1f9fd0e03736.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_ca1bc2fb2ef088a4efd46c51a82bde00_31bf3856ad364e35_6.2.9200.20731_none_491baf9f56956a73.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_cd429c9e15ee381c26a5e0baf4827c83_31bf3856ad364e35_6.2.9200.16626_none_0f27d460500da2ea.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_df0cfec14a8238c163c13c58cc81a786_31bf3856ad364e35_6.2.9200.16626_none_ae3e431041d7f796.manifest
File versionNot applicable
File size679
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_df3ebc3a731bf6deb672200943c6478e_31bf3856ad364e35_6.2.9200.20731_none_97d75da7cf2623ec.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_e2c64b7dcfafaf4972521c5451fe0969_31bf3856ad364e35_6.2.9200.20731_none_e49db3e242b39446.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_eec6c535ad67563dd8b8f6ac043dfe2b_31bf3856ad364e35_6.2.9200.20731_none_531160cca4650930.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_f62187109141bad6db8b1238954791e1_31bf3856ad364e35_6.2.9200.16626_none_d4bb2854267c0cd5.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameAmd64_f84e3899861bc6b7dd8c4a426046ab50_31bf3856ad364e35_6.2.9200.16626_none_34f7425e013d0e5a.manifest
File versionNot applicable
File size687
Date (UTC)30-May-2013
Time (UTC)15:34
PlatformNot applicable
File nameMsil_system.management.automation_31bf3856ad364e35_6.2.9200.16626_none_996281338d2c68d2.manifest
File versionNot applicable
File size1,718
Date (UTC)30-May-2013
Time (UTC)02:53
PlatformNot applicable
File nameMsil_system.management.automation_31bf3856ad364e35_6.2.9200.20731_none_82964ca5a6d2620a.manifest
File versionNot applicable
File size1,718
Date (UTC)30-May-2013
Time (UTC)08:09
PlatformNot applicable

↑ Back to the top


Keywords: kb, kbqfe, kbhotfixserver, kbfix, kbsurveynew, kbexpertiseadvanced, kbautohotfix

↑ Back to the top

Article Info
Article ID : 2830615
Revision : 1
Created on : 1/7/2017
Published on : 7/10/2013
Exists online : False
Views : 195