Forum Discussion
darangua
Feb 03, 2020Copper Contributor
Access denied when I want create to File in Powershell
Hi, Please, your help me! I have problem to access denied, when i want create to file. I have the account in the group administrator. I valued the permission in the tab security and i have admini...
- Feb 03, 2020
Hi darangua
I reread your post - I missed something in the original.
When you export out, you need to name the exported file name, not just the folder location. Try:
$cre | Export-Clixml -Path c:\test\name.xml
This will export out the name.xlm file in the test folder.
The result:
Hope this helps,
Mark
HidMov
Feb 03, 2020Steel Contributor
Hi darangua
If I remember correctly the C:\ drive is normally locked down extra tight to stop files appearing in the root. Are you able to use another location (i.e. C:\outputfolder)? If not, can you let me know what OS you are using (i.e. Windows 10 home, Server 2019 etc) and if this is a domain joined computer?
Thanks,
Mark
darangua
Feb 03, 2020Copper Contributor
Hi HidMov ,
I trying with another path and the same error.
The error is S.O Windows 10 pro and Windows server 2019 Standard, the computers in domain
Error:
PS U:\> $cre | Export-Clixml -Path C:\Test
Export-Clixml : Acceso denegado a la ruta de acceso 'C:\Test'.
En lÃnea: 1 Carácter: 8
+ $cre | Export-Clixml -Path C:\Test
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Export-Clixml], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportClixmlCommand
Regards.
- HidMovFeb 03, 2020Steel Contributor
Hi darangua
I reread your post - I missed something in the original.
When you export out, you need to name the exported file name, not just the folder location. Try:
$cre | Export-Clixml -Path c:\test\name.xml
This will export out the name.xlm file in the test folder.
The result:
Hope this helps,
Mark
- RokeJulianLockhartDec 19, 2024Brass Contributor
Strange that the error message doesn't explicitly state this.
- NavUK2022May 16, 2022Copper Contributor
In my script, powershell is set to add a logfile after copying a file in the running script in
C:\LOGS
I was getting error
+ CategoryInfo : OpenError: (:) [Out-File], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommandResolved by
NTFS security permission to C:\Logs (the location of the folder where the file is out-put)
Permission was assigned to the Local Admin Service Account that was running the Task Schdule scipt
$LogFile = "C:\LOGS\LogFile_$(get-date -f yyyy-MM-dd).txt"
- daranguaFeb 03, 2020Copper Contributorthe message to error "denied" is not very clear jajaja , very thanks