locked
File Validation CI RRS feed

  • Question

  • I have created a general CI to check if a file exists (file ought to exist) using PowerShell.  The client is Vista x86 SP2.

    if (test-path "c:\requiredfile.exe") {write-host "Compliant"} else {write-host "Failed"}

    Report non-compliance is unchecked.

    Validation is set to String equals Compliant.  Noncompliance severity is set to Error.

    On a computer which has c:\requiredfile.exe, the report shows Error for actual compliance state and Warning for non-compliance severity.

    What am I doing wrong?  Thank you.

    Sunday, December 12, 2010 10:27 AM

Answers

  • Output of scripts in a CI are not checked for content, they are simply checked no output or no output. If output, the check performed in the script is considered compliant, if no output, the check is considered non-compliant.

    Why are you using a script though? The build object file check checks for the existance of a file.


    Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
    Sunday, December 12, 2010 4:20 PM
  • If the script returns an error code, or encounters an unhandled error, then the setting will be reported as Error.  What the script echos or writes is just considered the instances of the setting that were found.  In your rule, you specify what is the expected result, and if you echo/write that expected result in the script, it will be Compliant.  If you echo/write anything other than that expected value, it will be reported as Non-compliant with actual value of what you echoed. 

    If the script returns something (not echo, but return), then it will be Error.

    Like Jason said though, you should just do this using the built in File Object setting.

    Kevin


    This posting is provided "AS IS", provides no warranties, and confers no rights. -- Kevin
    Tuesday, February 15, 2011 8:29 PM

All replies

  • Output of scripts in a CI are not checked for content, they are simply checked no output or no output. If output, the check performed in the script is considered compliant, if no output, the check is considered non-compliant.

    Why are you using a script though? The build object file check checks for the existance of a file.


    Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
    Sunday, December 12, 2010 4:20 PM
  • If the script returns an error code, or encounters an unhandled error, then the setting will be reported as Error.  What the script echos or writes is just considered the instances of the setting that were found.  In your rule, you specify what is the expected result, and if you echo/write that expected result in the script, it will be Compliant.  If you echo/write anything other than that expected value, it will be reported as Non-compliant with actual value of what you echoed. 

    If the script returns something (not echo, but return), then it will be Error.

    Like Jason said though, you should just do this using the built in File Object setting.

    Kevin


    This posting is provided "AS IS", provides no warranties, and confers no rights. -- Kevin
    Tuesday, February 15, 2011 8:29 PM