none
Parameter hash verification error on PowerShell script RRS feed

  • Question

  • I have created a PowerShell script which will create a permanent WMI Event subscription on my site clients.  When I run the script through SCCM I receive an error 0x87d0029e in the Script.log file.  It states "Parameter hash verification for script 67E7467E-4544-458A-9399-760569B5E001 failed".  When I copy and paste the script into a PowerShell console windows and run it, the scripts works fine.  I have tried the script on both Windows 7 and Windows 10 clients and get the same results.  The script is designed to use a commandline event consumer to launch a scheduled task.  Everything works when run manually, but fails when ran by the Script feature of SCCM.

    I have a small site of 10000 clients using SCCM CB1902, and all clients are upgraded with this latest version   Please find below the script and entries from the Script.log file.

    any help you can offer on how to resolve the error will be appreciated.

    [CmdletBinding()]
    Param(
      [Parameter(Mandatory=$false)]
      [string]$task="Inventory_IE_BrowserHistory",               # name of a scheduled task to run
      [Parameter(Mandatory=$false)]
      [string]$query="Select * from win32_ProcessStartTrace where processname = 'javaw.exe' OR processname = 'javaws.exe'"               # WMI query using WQL format
    )
    <#
    .EXAMPLE
       $task = "Inventory_IE_BrowserHistory"
       $query = "Select * from win32_ProcessStartTrace where processname = 'javaw.exe' OR processname = 'javaws.exe'"
    #>
    
    #Set up some hash tables for splatting
    $wmiParams = @{
        Computername = $env:COMPUTERNAME
        ErrorAction = 'Stop'
        NameSpace = 'root\subscription'
    }
    
    #Creating a new event filter
    $wmiParams.Class = '__EventFilter'
    $wmiParams.Arguments = @{
        Name = 'ProcessFilter'
        EventNamespace = 'root\CIMV2'
        QueryLanguage = 'WQL'
        Query = $query
    }
    $filterResult = Set-WmiInstance @wmiParams
    
    
    $wmiParams.Class = 'CommandLineEventConsumer'
    $wmiParams.Arguments = @{
        Name = 'ProcessConsumer'
       CommandLineTemplate = "C:\Windows\System32\schtasks.exe /run /TN $task"
    }
    $consumerResult = Set-WmiInstance @wmiParams
    
    $wmiParams.Class = '__FilterToConsumerBinding'
    $wmiParams.Arguments = @{
        Filter = $filterResult
        Consumer = $consumerResult
    }
    $bindingResult = Set-WmiInstance @wmiParams
    
    
    <#
    ##Removing WMI Subscriptions using Remove-WMIObject
    #Filter
    Get-WMIObject -Namespace root\Subscription -Class __EventFilter -Filter "Name='ProcessFilter'" | Remove-WmiObject -Verbose
     
    #Consumer
    Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer -Filter "Name='ProcessConsumer'" | Remove-WmiObject -Verbose
     
    #Binding
    Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding -Filter "__Path LIKE '%ProcessFilter%'"  | Remove-WmiObject -Verbose
    #>

    Parsing the Script Execution Message ...
    
    Script Guid: 67E7467E-4544-458A-9399-760569B5E001
    
    Parameter hash verification for script 67E7467E-4544-458A-9399-760569B5E001 failed.
    
    CScriptsEndpoint:Parameter hash verification failed with error 0x87d0029e
    
    Parameter hash verifiction failed for script with guid 67E7467E-4544-458A-9399-760569B5E001. Error 0x87d0029e


    Tuesday, August 13, 2019 9:02 PM

Answers

  • Hello,
     
    The issue seems is about the parameter $query. If remove it from parameters and just use it as a variable in the scripts, the script works without any errors.
     
    Hope my answer could help you and look forward to your feedback.
     
    Best Regards,
    Ray

    Please remembers to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Marked as answer by pnnl Wednesday, August 14, 2019 5:53 PM
    Wednesday, August 14, 2019 8:16 AM

All replies

  • Hello,
     
    The issue seems is about the parameter $query. If remove it from parameters and just use it as a variable in the scripts, the script works without any errors.
     
    Hope my answer could help you and look forward to your feedback.
     
    Best Regards,
    Ray

    Please remembers to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Marked as answer by pnnl Wednesday, August 14, 2019 5:53 PM
    Wednesday, August 14, 2019 8:16 AM
  • Thank you for your reply.  You are correct.  The SCCM Script feature does not appears to accept a single quote character from within a string parameter.  I created a simple version of my script and tried to include a single quote in the parameter, but it failed every time.  This is a limiting feature.

    I have marked this question as answered.  Your workaround appears to be the only solution for my script.  I appreciate your help.

    Wednesday, August 14, 2019 5:53 PM