diff options
Diffstat (limited to 'lib/ansible/module_utils/powershell')
-rw-r--r-- | lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1 | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1 index 727da967f6..857bd1bfdf 100644 --- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1 +++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1 @@ -19,6 +19,10 @@ Function Test-AnsiblePath { $file_attributes = [System.IO.File]::GetAttributes($Path) } catch [System.IO.FileNotFoundException], [System.IO.DirectoryNotFoundException] { return $false + } catch [NotSupportedException] { + # When testing a path like Cert:\LocalMachine\My, System.IO.File will + # not work, we just revert back to using Test-Path for this + return Test-Path -Path $Path } if ([Int32]$file_attributes -eq -1) { |