Hey PatchMyPC
I have an issue to report regarding the PowerShell Script that is being used to detect your pre-made SCCM applications.
Issue:
Particular machines trying to deploy an application are reporting an error code of 0xffffffff. The Error Description in SCCM for the deployment is 'Script execution failed with error code -1'
Symptoms:
The AppDiscovery.log file on the affected machines display the error in more detail, stating:
In-line script returned error output: Get-ItemProperty : Specified cast is not valid.
At C:\Windows\CCM\SystemTemp\9f53767d-d483-4ff6-9523-d65e723a65d6.ps1:103
char:5
+ Get-ItemProperty $regpath | .{process{if($_.DisplayName -and
$_.UninstallStr ...
In reference to the particular line of the script, it is trying to run:
Get-ItemProperty $regpath | .{process{if($_.DisplayName -and $_.UninstallString) { $_ } }} | Select-Object DisplayName, DisplayVersion, UninstallString, PSChildName, Publisher, InstallDate | Sort DisplayName
Cause:
The problem, as reported on GitHub (see: https://github.com/majkinetor/au-packages/issues/15) is that Get-ItemProperty cannot interpret invalid DWORD entries. On the affected machines, due to bespoke custom applications installed, invalid DWORD entries exist within the Uninstall areas of the registry. Therefore, the script fails at this point and fails to evaluate whether the app is installed, thus preventing it from being deployed.
Because we allow software to be freely installed, there is an infinite possibility that an application generating a bad DWORD registry entry can be installed to any of our machines. This would stop ANY PatchMyPC application from deploying, as this part of the script is generic.
Can a fix be implemented for this please? I have attached images for reference.
What is the version of PatchMyPC-ScriptRunner.exe in the app source files?
We have a new private build (1.5.3.3) that we believe should help with this scenario. Can you test the preview build by downloading the MSI here https://patchmypc-my.sharepoint.com/:u:/p/support/EVy8KUZy011LkoMVLgGFQCsBpXpt_klaTiZJXaIb1gglZA?e=zSOng0
Please delete the applications having this issue as described here:
How to Delete Applications Created by Patch My PC in SCCM - https://patchmypc.com/how-to-delete-applications-created-by-patch-my-pc-in-sccm
And run a sync to have it re-create and test it the detection method script works.
Heya
So on some machines that has been fixed with this preview. However I have noticed a different error occurring on some machines, which still presents the 0xfffffff error code.
AppDiscovery reports the following:
In-line script returned error output: Get-ItemProperty : The member "UninstallString" is already present.
At C:\Windows\CCM\SystemTemp\4ac20652-7723-43df-b9fe-0e3a51c6a08a.ps1:105 char:
21
+ Get-ItemProperty <<<< $regpath -Name $propertyNames -ErrorAction Silentl
yContinue | .{process{if($_.DisplayName -and $_.UninstallString) { $_ } }} | Se
lect-Object DisplayName, DisplayVersion, UninstallString, PSChildName, Publishe
r, InstallDate | Sort DisplayName
+ CategoryInfo : NotSpecified: (:) [Get-ItemProperty], ExtendedTy
peSystemException
+ FullyQualifiedErrorId : AlreadyPresentPSMemberInfoInternalCollectionAdd,
Microsoft.PowerShell.Commands.GetItemPropertyCommand
I have attached an image for reference.
Russell
Can you export both your Uninstall keys:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
And email it as ZIP here https://patchmypc.com/technical-support.
I have just emailed them over, taken from an example machine with the issue :)
Can you try this internal build? https://patchmypc-my.sharepoint.com/:u:/p/support/EeD6uagDAl9KqGo5AlD4T3IB8Ygwf1Qh1cVnru0_RrtHLQ?e=L9Y1Ft
You will need to delete the app and re-create it to test the fix.
Having tried that, I now see a new issue:
In-line script returned error output: Method invocation failed because [System.Version] doesn't contain a method name
d 'Parse'.
At C:\Windows\CCM\SystemTemp\6dcf40f1-e8ac-4aa1-aaae-b9ffa2ffa7cc.ps1:118 char:
35
+ return [System.Version]::Parse <<<< ("0.0.0.0")
+ CategoryInfo : InvalidOperation: (Parse:String) [], RuntimeExce
ption
+ FullyQualifiedErrorId : MethodNotFound
Method invocation failed because [System.Version] doesn't contain a method name
d 'Parse'.
At C:\Windows\CCM\SystemTemp\6dcf40f1-e8ac-4aa1-aaae-b9ffa2ffa7cc.ps1:118 char:
35
+ return [System.Version]::Parse <<<< ("0.0.0.0")
+ CategoryInfo : InvalidOperation: (Parse:String) [], RuntimeExce
ption
+ FullyQualifiedErrorId : MethodNotFound
You cannot call a method on a null-valued expression.
I have attached another screenshot.
Russell
What is the PowerShell version?
It should be Powershell 5.0 as most machines are currently on Windows 10 1709.
Was that machine in the screenshot PowerShell 5?
Apologies - I have just double checked and this machine is actually a Windows 7 PC. The other machine experiencing this problem as well is also Windows 7. So the version of Powershell will be older, likely 2.0
The parse bug for PowerShell 2.0 should be fixed in this internal build https://patchmypc-my.sharepoint.com/:u:/p/support/EQdRn91O-79Hv5yUlvFWv7cBfP-H9M2wyQAB4XXHvM0J5A?e=4wNSds
Could you test for us you will need to delete the SCCM app + source files and run a sync to re-create it.
Quote from: rbuxcey on October 04, 2019, 10:23:34 AM
Apologies - I have just double checked and this machine is actually a Windows 7 PC. The other machine experiencing this problem as well is also Windows 7. So the version of Powershell will be older, likely 2.0
Thats appears to have fixed the issue - thank you!