SOLVED

Access denied when I want create to File in Powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-1148673%22%20slang%3D%22es-ES%22%3EAccess%20denied%20when%20I%20want%20create%20to%20File%20in%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1148673%22%20slang%3D%22es-ES%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EPlease%2C%20your%20help%20me!%3C%2FP%3E%3CP%3EI%20have%20problem%20to%20access%20denied%2C%20when%20i%20want%20to%20create%20to%20file.%3C%2FP%3E%3CP%3EI%20have%20the%20account%20in%20the%20group%20administrator.%3C%2FP%3E%3CP%3EI%20valued%20the%20permission%20in%20the%20tab%20security%20and%20i%20have%20administrator%20permission.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%20U%3AA%26gt%3B%20%24cre%20%3F%20Export-Clixml%20-Path%20C%3ATM%3CBR%20%2F%3EExport-Clixml%20%3A%20Access%20denied%20to%20path%20'C%3ATM'.%20%3CBR%20%2F%3EOnline%3A%201%20Character%3A%3CBR%20%2F%3E8%20%2B%20%24cre%20Export-Clixml%20-Path%20C%3A-%3CBR%20%2F%3E%2B%20s---%3CBR%20%2F%3EOpenError%3A%20(%3A)%20%5BExport-Clixml%5D%2C%20UnauthorizedAccessException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20FileOpenFailure%2CMicrosoft.PowerShell.Commands.ExportClixmlCommand%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168703iC92B5FFD5957F294%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ERegards.%3C%2FP%3E%3CP%3E%23PowerShell%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1148673%22%20slang%3D%22es-ES%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1148727%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20denied%20when%20I%20want%20create%20to%20File%20in%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1148727%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F380138%22%20target%3D%22_blank%22%3E%40darangua%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20remember%20correctly%20the%20C%3A%5C%20drive%20is%20normally%20locked%20down%20extra%20tight%20to%20stop%20files%20appearing%20in%20the%20root.%20Are%20you%20able%20to%20use%20another%20location%20(i.e.%20C%3A%5Coutputfolder)%3F%20If%20not%2C%20can%20you%20let%20me%20know%20what%20OS%20you%20are%20using%20(i.e.%20Windows%2010%20home%2C%20Server%202019%20etc)%20and%20if%20this%20is%20a%20domain%20joined%20computer%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EMark%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1148839%22%20slang%3D%22es-ES%22%3ERe%3A%20Access%20denied%20when%20I%20want%20create%20to%20File%20in%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1148839%22%20slang%3D%22es-ES%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F383653%22%20target%3D%22_blank%22%3E%40HidMov%3C%2FA%3E%20%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20trying%20with%20another%20path%20and%20the%20same%20error.%3C%2FP%3E%3CP%3EThe%20error%20is%20S.O%20Windows%2010%20pro%20and%20Windows%20server%202019%20Standard%2C%20the%20computers%20in%20domain%3C%2FP%3E%3CP%3EError%3A%3C%2FP%3E%3CP%3EPS%20U%3AA%26gt%3B%20%24cre%20%3F%20Export-Clixml%20-Path%20C%3A-Test%3CBR%20%2F%3EExport-Clixml%20%3A%20Access%20denied%20to%20path%20'C%3A-Test'.%20%3CBR%20%2F%3EOnline%3A%201%20Character%3A%3CBR%20%2F%3E8%20%2B%20%24cre%20Export-Clixml%20-Path%20C%3A'Test%3CBR%20%2F%3E%2B%20%3A)%3C%2Fimg%3E%20'%3CBR%20%2F%3Es'%20s'%20'%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20.%20%5BExport-Clixml%5D%2C%20UnauthorizedAccessException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20FileOpenFailure%2CMicrosoft.PowerShell.Commands.ExportClixmlCommand%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1148862%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20denied%20when%20I%20want%20create%20to%20File%20in%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1148862%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F380138%22%20target%3D%22_blank%22%3E%40darangua%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20reread%20your%20post%20-%20I%20missed%20something%20in%20the%20original.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20you%20export%20out%2C%20you%20need%20to%20name%20the%20exported%20file%20name%2C%20not%20just%20the%20folder%20location.%20Try%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24cre%20%7C%20Export-Clixml%20-Path%20c%3A%5Ctest%5Cname.xml%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20will%20export%20out%20the%20name.xlm%20file%20in%20the%20test%20folder.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168730i06D471CCE1B733D5%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20result%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168731i4FA07F537EEF24A5%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_1.png%22%20title%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMark%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1148867%22%20slang%3D%22es-ES%22%3ERe%3A%20Access%20denied%20when%20I%20want%20create%20to%20File%20in%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1148867%22%20slang%3D%22es-ES%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F383653%22%20target%3D%22_blank%22%3E%40HidMov%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1148873%22%20slang%3D%22es-ES%22%3ERe%3A%20Access%20denied%20when%20I%20want%20create%20to%20File%20in%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1148873%22%20slang%3D%22es-ES%22%3Ethe%20message%20to%20error%20%22denied%22%20is%20not%20very%20clear%20jajaja%20%2C%20very%20thanks%3C%2FLINGO-BODY%3E
Occasional Contributor

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 administrator permission.

 

PS U:\> $cre | Export-Clixml -Path C:\
Export-Clixml : Acceso denegado a la ruta de acceso 'C:\'.
En línea: 1 Carácter: 8
+ $cre | Export-Clixml -Path C:\
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Export-Clixml], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportClixmlCommand

clipboard_image_0.png

Regards.

#PowerShell

 

5 Replies

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

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.

 

 

 

Best Response confirmed by darangua (Occasional Contributor)
Solution

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.

 

clipboard_image_0.png

 

The result:

 

clipboard_image_1.png

 

Hope this helps,

 

Mark

the message to error "denied" is not very clear jajaja , very thanks