SOLVED

Access denied when I want create to File in Powershell

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