Closed kuhaqzf1 closed 3 years ago
@kuhaqzf1 Thank you for reporting the issue.
I think this is a general PowerShell issue as Invoke-PSRule
does not write to any files by default unless you specify -OutputPath
.
Can you please try Get-ChildItem -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PSRule\' -Recurse | Unblock-File;
within an administrator / elevated PowerShell prompt.
I am past that error. Thanks for your assistance. However; now I am getting this error: Invoke-PSRule : Cannot bind argument to parameter 'InputObject' because it is null. At line:1 char:14 Invoke-PSRule : Cannot bind argument to parameter 'InputObject' because it is null. At line:1 char:14
+ CategoryInfo : InvalidData: (:) [Invoke-PSRule], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Invoke-PSRule
PS C:\users\fhaq>
@kuhaqzf1 The error is suggesting that $resources
is null or the items on $resources
contains null values. -InputObject
only accepts non-null values.
Are you able to share what you are using to populate $resources
?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.
This issue was closed because it has not had any recent activity.
Description of the issue
When I try to execute a rule using Invoke-PSRule command I get Access to the path 'c:\users\fhaq\AppData\Local\Application Data' is denied. At C:\Program Files (x86)\WindowsPowerShell\Modules\PSRule\1.1.0\PSRule.psm1:1677 char:17
Steps to reproduce the issue:
$resources | Invoke-PSRule -Option .\ps-rule.yaml Expected behaviour
Execute rule and pipe the target object to Invoke-PSRule. Error output
Access to the path 'c:\users\fhaq\AppData\Local\Application Data' is denied. At C:\Program Files (x86)\WindowsPowerShell\Modules\PSRule\1.1.0\PSRule.psm1:1677 char:17
throw $_.Exception.GetBaseException();
Module: PSRule
Version: [e.g. 1.0.0]
Captured output from
$PSVersionTable
:Name Value
PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Additional context
I get the same error if I try to execute any rule with Invoke-PSRule
Define objects to validate
$items = @(); $items += [PSCustomObject]@{ Name = 'Fridge' }; $items += [PSCustomObject]@{ Name = 'Apple' };
Validate each item using rules saved in current working path
$items | Invoke-PSRule;