Forum Discussion

darangua's avatar
darangua
Copper Contributor
Feb 03, 2020
Solved

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 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

Regards.

#PowerShell

 

  • HidMov's avatar
    HidMov
    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's avatar
    HidMov
    Steel 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's avatar
      darangua
      Copper 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.

       

       

       

      • HidMov's avatar
        HidMov
        Steel 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

Resources