Share via


Outfile : Access to the path is denied

Question

Monday, February 11, 2013 1:04 PM

Hello,

i have the following .ps1-script :

Get-MailboxImportRequest | Get-MailboxImportRequestStatistics -IncludeReport | Format-List > "E:\Logfiles"

Output of this :

out-file : Access to the path 'E:\Logfiles' is denied.
At E:\Scripts\logfile_import_request.ps1:1 char:1

  • Get-MailboxImportRequest | Get-MailboxImportRequestStatistics -IncludeReport | F ...

    + CategoryInfo          : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

I have checked NTFS-rights but still same problem.

Howto fix this?

Thx

All replies (4)

Monday, February 11, 2013 1:16 PM âś…Answered | 2 votes

Is "Logfiles" a proper file? Seems to me you are trying to redirect the output into a directory. That may be the reason for this error.

Try for example:

Get-MailboxImportRequest | Get-MailboxImportRequestStatistics -IncludeReport | Format-List > "E:\Logfiles\test.log"

Regards,

wizend


Monday, February 11, 2013 1:14 PM

Should be related to NTFS permissions on the E:drive or Logfiles folder.
Check by creating any new file under E:\logfiles with the cred which you are using to run the script.

I know...you checked the NTFS rights...But still...the error is pointing to that only. Please re-check.

Have a greatday

Azam


Monday, February 11, 2013 1:52 PM

Thx wizend,

this is the clue!


Monday, February 11, 2013 5:21 PM

What does

 

attrib E:\Logfiles

 

show?