cyberark / CYBRHardeningCheck

A utility to check CyberArk component servers hardening status
GNU General Public License v3.0
53 stars 25 forks source link

Command "!Test-Path" error #74

Closed redboyhun closed 3 years ago

redboyhun commented 3 years ago

LOG: [ERROR] Could not complete security analysis. Error: Source:System.Management.Automation; Message: The term '!Test-Path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Command in file: bin\GeneralHardeningSteps.psm1:61: if(!Test-Path $INFconfigFilePath)

Test with valid path results also in error: PS D:\CYBRHardeningCheck-v3.1_signed> !Test-Path "C:\temp" !Test-Path : The term '!Test-Path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

AngryPanda25 commented 2 years ago

Good Day Guys i am getting this error , I have the V3.1 of the tool , i cant seem to find a way to get around this Hardening_HealthCheck.log

AssafMiron commented 2 years ago

Hello @AngryPanda25 ,

Go to the file GeneralHardeningSteps.psm1 (under the bin folder) Find function "ImportingINFConfiguration" I think this is line 61 Change from: if(!Test-Path $INFconfigFilePath) To: if( -not (Test-Path $INFconfigFilePath))

That should solve the issue I will make sure that in the next merge, this fix will be there as well

Regards, Assaf

AngryPanda25 commented 2 years ago

100% will do the changes and revert back , thank you very much

AngryPanda25 commented 2 years ago

Did the trick , thank you very much