none
Powershell crashes with Microsoft.Update.Searcher RRS feed

  • General discussion

  • Hi,

    This causes my powershell window to crash often. Any clue ?

    $windowsUpdate = New-object -com “Microsoft.Update.Searcher”
    $totalUpdates = $windowsUpdate.GetTotalHistoryCount()
    [array]$allUpdates = $windowsUpdate.QueryHistory(0,$totalUpdates) | Where-Object {($_.ResultCode -eq 2)-and ($_.HResult -eq 0) }
    $allUpdates


    Friday, July 24, 2015 2:25 PM

All replies

  • You need to repair your computer.  This is not the correct forum for help with this.


    \_(ツ)_/

    Friday, July 24, 2015 2:37 PM
  • This happens across servers both on windows server 2K8R2 and 2012 R2 besides my computer. This is from eventviewer log :

    Faulting application name: powershell.exe, version: 6.3.9600.16406, time stamp: 0x5244e9dc
    Faulting module name: System.Management.Automation.ni.dll, version: 6.3.9600.16406, time stamp: 0x5244a9b0
    Exception code: 0x80131623
    Fault offset: 0x000000000127c87f
    Faulting process id: 0x15d4
    Faulting application start time: 0x01d0c61beb0aa6d1
    Faulting application path: C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe
    Faulting module path: C:\windows\assembly\NativeImages_v4.0.30319_64\System.Manaa57fc8cc#\b90384b5952a475147d9c9a2cd1e9c3d\System.Management.Automation.ni.dll
    Report Id: 2c45bc35-320f-11e5-bc14-a0b3cc21fbd9

    Friday, July 24, 2015 2:50 PM
  • Not a scripting issue.  You need to fix your system.

    \_(ツ)_/

    Friday, July 24, 2015 2:59 PM
  • Hey jrv

    did you even try this before posting ?  I think you need to run this to appreciate what my concerns are. These lines are part of a diagnostics tool which outputs result in an xml file. Eveything is perfect till $allUpdates, then when i process the contents of the variable , it crashes.

    It's kind of random in nature.Sometimes it runs perfectly and other times it does not.

    I think you need to run these to see what i mean . Please try it for a couple of times before posting next time.

    Thanks  for your quick response.

    Friday, July 24, 2015 5:19 PM
  • Hey jrv

    did you even try this before posting ?  I think you need to run this to appreciate what my concerns are. These lines are part of a diagnostics tool which outputs result in an xml file. Eveything is perfect till $allUpdates, then when i process the contents of the variable , it crashes.

    It's kind of random in nature.Sometimes it runs perfectly and other times it does not.

    I think you need to run these to see what i mean . Please try it for a couple of times before posting next time.

    Thanks  for your quick response.

    Yes I have used the update searcher class for years.


    \_(ツ)_/

    Friday, July 24, 2015 5:47 PM
  • Just to satisfy you I ran your exact code with copy/paste and it runs without issue.

    You need to fix your systems.


    \_(ツ)_/

    Friday, July 24, 2015 5:50 PM
  • This fails for me as well. I tried on multiple versions and operating systems and it crashes each time for me.

    Win7:

    PS C:\> $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      4.0
    WSManStackVersion              3.0
    SerializationVersion           1.1.0.1
    CLRVersion                     4.0.30319.34209
    BuildVersion                   6.3.9600.16406
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
    PSRemotingProtocolVersion      2.2

    WS2012:

    PS C:\> $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      3.0
    WSManStackVersion              3.0
    SerializationVersion           1.1.0.1
    CLRVersion                     4.0.30319.34209
    BuildVersion                   6.2.9200.17065
    PSCompatibleVersions           {1.0, 2.0, 3.0}
    PSRemotingProtocolVersion      2.2

    WS2012R2:

    PS C:\> $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      4.0
    WSManStackVersion              3.0
    SerializationVersion           1.1.0.1
    CLRVersion                     4.0.30319.34209
    BuildVersion                   6.3.9600.17400
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
    PSRemotingProtocolVersion      2.2

    jrv - Are you on Win8.1? I don't have any handy to test with.


    EDIT: Quick fix - use the ISE instead of the console.

    Friday, July 24, 2015 6:24 PM
  • I am on 8.1/7/2008R2

    I will test on 2012R2 later buit all work and all versions of Ps 3,4,5


    \_(ツ)_/

    Friday, July 24, 2015 7:03 PM
  • Check up your Event Logs. There shout be an error event in your logs (Logname: Application; ProviderName: .NET Runtime and/or Microsoft-Windows-Powershell). It should give you more information about the cause of your crashes.

    Maybe, you could post the error messages.

    wizend

    Friday, July 24, 2015 7:51 PM
  • Interesting:

    Application: powershell.exe
    Framework Version: v4.0.30319
    Description: The application requested process termination through System.Environment.FailFast(string message).
    Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


    Friday, July 24, 2015 10:19 PM
  • If you look up the error code or the "FailFast()" bit you will see that it is Net Framework that is shutting down.  PowerShell is build on NetF and is just being dragged along for the ride.

    I suspect a missing patch or a new hotfix that has gone awry.


    \_(ツ)_/

    Friday, July 24, 2015 11:03 PM
  • Windows 2012R2 - no errors.  It is actually a new and almost pristeen copy I built last week and set up as a DC  It just works like anything else.


    \_(ツ)_/


    • Edited by jrv Friday, July 24, 2015 11:20 PM
    Friday, July 24, 2015 11:19 PM
  • Do the failing 2012 servers have SharePoint installed?  Do they have IIS installed?

    \_(ツ)_/


    • Edited by jrv Saturday, July 25, 2015 12:45 AM
    Saturday, July 25, 2015 12:37 AM
  • This has failed on Win7,2008 R2,2012 and 2012 R2. I have not tried on Win8 versions. 

    and on server versions i have IIS installed. 

    Saturday, July 25, 2015 4:18 AM
  • This has failed on Win7,2008 R2,2012 and 2012 R2. I have not tried on Win8 versions. 

    and on server versions i have IIS installed. 

    I have IIS on Win 8.1, WS2008R2.  I do not have it on WS2012R2.

    I see there are issues with SharePoint with  that exception.  I cannot reproduce the error on any platform so far.

    Start from a fresh boot to see if it always happens or only after the system has been running.


    \_(ツ)_/

    Saturday, July 25, 2015 4:21 AM
  • Exactly to your thinking, I tried with a reboot to see if it occurs and it did occur. The behavior is random; sometimes it runs and other times it keeps on failing. Unreliable is all i can say about Microsoft.Update.Searcher class.

    Can i get update history with some other means ? 

    Saturday, July 25, 2015 4:39 AM
  • The problem is not the update searcher it is the system.  The WUS has been used for years with no issue.

    As I noted. I cannot reproduce your issue.  You should contact MS support for assistance as it is likely due to a configuration that is unique to your systems.  We cannot fix this in this forum.


    \_(ツ)_/

    Saturday, July 25, 2015 4:45 AM
  • It is not unique to my system. It's happening across platforms. Even though WUS has been used for years and with no issue, does not guarantee it would be issue less in future. I definitely need to contact MS support for assistance. In the meantime. if someone find something please update it .

    thanks jrv .Appreciate your replies.

    Saturday, July 25, 2015 5:42 AM