Forum Discussion

ElieAT's avatar
ElieAT
Iron Contributor
Jan 23, 2023

Script for compliance policy

Hello,

 

Kindly need to know why im getting status error when configuring the compliance policy script?

We tested on the machine it worked fine but when uploaded with the json file on intune we dont have the results succeeded.

The script is about finding a software on the device and if it exists it will show the device is compliant.

 

Regards,

 

 

3 Replies

  • ElieAT 

    Could you provide some more information? Contents of the json, the script itself etc.

    Otherwise its going to be hard to tell you what could be going wrong.

    • ElieAT's avatar
      ElieAT
      Iron Contributor
      Script:
      return Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | select DisplayName, Publisher, InstallDate | ConvertTo-Json -Compress

      $WMI_ComputerSystem = Get-WMIObject -class Win32_ComputerSystem
      $WMI_BIOS = Get-WMIObject -class Win32_BIOS
      $TPM = Get-Tpm

      Json:

      {
      "Rules":[
      {
      "SettingName":"DisplayName",
      "Operator":"IsEquals",
      "DataType":"String",
      "Operand":"FortiClient",
      "MoreInfoUrl":"https://bing.com",
      "RemediationStrings":[
      {
      "Language":"en_US",
      "Title":"CHECKED INSTALLED SOFTAWE",
      "Description": "BIOS must be updated. Please refer to the link above"
      }
      ]
      },

      ]
      }

      Other Script:


      $hash = @{ ModelName = $WMI_ComputerSystem.Model; BiosVersion = $WMI_BIOS.SMBIOSBIOSVersion; TPMChipPresent = $TPM.TPMPresent}
      return $hash | ConvertTo-Json -Compress

      Json:

      {
      "Rules":[
      {
      "SettingName":"ModelName",
      "Operator":"IsEquals",
      "DataType":"String",
      "Operand":"HP ENVY 15 Notebook PC",
      "MoreInfoUrl":"https://bing.com",
      "RemediationStrings":[
      {
      "Language":"en_US",
      "Title":"BIOS Version needs to be upgraded to at least 2.3. Value discovered was {ActualValue}.",
      "Description": "BIOS must be updated. Please refer to the link above"
      }
      ]
      },

      ]
      }

      I tried them and didnt work.

      Regards,