Skip to content

Cannot save PowerShell script due to parsing error #7

@rem8

Description

@rem8

I have a script which I want to run against ACS. I cannot put it into SCOM as it pops up error of wrong formatting.

ABB ACS Addendum could not be imported.

If any management packs in the Import list are dependent on this management pack, the installation of the dependent management packs will fail.

Verification failed with 1 errors:

Error 1:
Found error in 1|ABB.ACS.Addendum|1.0.0.0|ConsoleTaskGeneratedByUI426b8d934af04d428698e3c92285a7c5/PA|| with message:
The configuration specified for Module PA is not valid.
: Incorrect expression specified: $data = . Unable to resolve this expression. Check the expression for errors. (Hints: Check for correct character casing (upper case/lower case), mismatched "$" signs, double quotes("), square brackets "[" or "]"). Here is a sample expression: $Data/EventNumber$


The line it bothers are as follows:

$cert = Get-ChildItem Cert:\LocalMachine\My | where {($.Issuer -eq "CN=RootCA, O=Contoso, DC=CONTOSO, DC=COM") -And ($.NotAfter - (Get-Date) -gt 0) -And ($.Subject -like "$($env:COMPUTERNAME)") -and ($.Thumbprint -eq (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Machine Settings' -Name ChannelCertificateHash).ChannelCertificateHash)}
$data = $cert.Thumbprint

It works correctly when run from PS or ISE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions