Windows 10: I can't delete folder or file at powershell event run it as administrator?

Discus and support I can't delete folder or file at powershell event run it as administrator? in Windows 10 Gaming to solve the problem; I have tried both of commands Remove-Item blog and Remove-Item blog -Recurse... Discussion in 'Windows 10 Gaming' started by YASİN KARA, May 14, 2025 at 11:52 AM.

  1. I can't delete folder or file at powershell event run it as administrator?


    I have tried both of commands Remove-Item blog and Remove-Item blog -Recurse

    :)
     
  2. ddelo Win User

    Export All Administrative Events to Excel

    To analyze events, from the Windows Event Viewer, there is a simple way to export all Administrative Events to Excel, with PowerShell.

    Exporting all Administrative Events to Excel is a simple two Step process, as described here:

    Step 1 - Create the Administrative Events View .xml file
    1. Open Eventviewer (%windir%\system32\eventvwr.msc)
    2. Navigate to: Event Viewer (Local) > Custom Views > Administrative Events
    3. In the “Actions” pane select “Filter Current Custom View”.
    4. Select the the XML tab.
    5. Press Ctrl+A to select all the XML code of the Custom View.
    6. Open a notepad, paste the selected code and save the file to your Desktop as AdmEvtView.xml


    Step 2 - Create the csv file with the events
    1. Download the ExportEvtCSV.zip file, which contains the script ExportEvtCSV.ps1 and unzip it, on your Desktop.
      It's not a fancy script, just basic PowerShell commands to create a csv file on the Desktop.
    2. In Windows Search, type “ISE” (without the quotes) to open “Windows PowerShell ISE” and Run as administrator
    3. To allow running the script, change the ExecutionPolicy, for this session. To do that, in the Console pane type:
      Code:
    4. In the Windows PowerShell ISE, open and run the script: ExportEvtCSV.ps1
      The script will create a csv file with a name YYYYMMDD.HHMM.csv on the Desktop
    5. When done, open the newly created .csv file, format the columns as needed and optionally save it as .xlsx, if you wish.
    That’s it! You now have all the Administrative Events in Excel for filtering and further analysis. I can't delete folder or file at powershell event run it as administrator? :)

    Now to the more technical hard stuff... *Confused

    There is a reason for running the script from within PowerShell ISE!

    It would be great if everything was also working perfectly, when running the script from an elevated PowerShell too.

    We can run it from an elevated PowerShell, which means that you just follow the Step 1, as above but for the Step 2 instead of the ISE you run the script from an elevated PowerShell.

    The problem is that it will work only for anybody who has en-US format for the dates. Everyone else, who has another format (i.e. en-GB, fr-FR, el-GR etc.), the dates are not translated properly by Excel (although the script uses the –UseCulture switch) and remain as text in the en-US format.

    I'm not sure if this a bug of the "export-csv" cmdlet, but although it runs the way it supposed to from within the ISE, from PowerShell there is a problem with the dates format.
    As I haven’t found a way to overcome this obstacle, any suggestion from the PowerShell gurus of the forum (like my good friend Shawn @Brink, for instance), is welcome.
     
  3. Trouble deleting a folder

    Thanks for the suggestion but it says "delete folder failed for E:\....." for each folder I try.

    *Confused I can't delete folder or file at powershell event run it as administrator? :confused:

    Will I be forever stuck with these unnecessary folders? *Oh Well I can't delete folder or file at powershell event run it as administrator? :eek:hwell:
     
  4. I can't delete folder or file at powershell event run it as administrator?

    Removing Windows.old folder

    I recently had to reinstall my OS (don't ask). Once I did there were files that I couldn't delete. Basically SecuROM files. Anyway long story short I found this workaround that I wanted to share with my fellow newbs. This will work for any file and works like a charm. Just follow the directions. *Toast :toast:
    Note: there is no space between "Administrators: (F)" I just had to but one in because it kept giving me an "unhappy face"

    When installing Windows Vista, Windows stores any existing installation of Windows on the install partition inside a hidden folder called windows.old. This folder could take up a large amount of disk space.

    Note: Please check the contents of the windows.old folder before deleting it to make sure there are no files stored there that you may wish to keep.

    Deleting the window.old folder using the disk cleanup wizard
    Click start
    Type: disk cleanup
    Press enter
    Select "Files from all users on this computer"
    Follow the rest of the instructions listed on the wizard and select the option to delete the windows.old folder
    Deleting the windows.old folder manually
    1) Open an elevated command prompt

    Click start
    Type: cmd
    right-click it under programs
    click Run As Administrator
    2) Take ownership


    Change the directory to the windows.old folder (e.g. cd c:\windows.old)
    Type: takeown /F . /A /R /D Y > NUL
    3) grant yourself permission

    Type: icacls . /grant:r Administrators: (F) /T /L /Q
    4) Delete everything

    Make sure you close any explorer or command windows that are looking at or inside the windows.old folder (except for the command window you are using). If you don't, you will receive an error while performing this step.

    Type: cd ..
    Type: rmdir /S /Q windows.old
     
Thema:

I can't delete folder or file at powershell event run it as administrator?

Loading...
  1. I can't delete folder or file at powershell event run it as administrator? - Similar Threads - can't delete folder

  2. I can't delete folder or file at powershell event run it as administrator?

    in Windows 10 Software and Apps
    I can't delete folder or file at powershell event run it as administrator?: I have tried both of commands Remove-Item blog and Remove-Item blog -Recurse https://answers.microsoft.com/en-us/windows/forum/all/i-cant-delete-folder-or-file-at-powershell-event/06540562-08db-4255-a6fa-d939ecf6f23e
  3. I can't delete folder or file at powershell event run it as administrator?

    in Windows 10 Customization
    I can't delete folder or file at powershell event run it as administrator?: I have tried both of commands Remove-Item blog and Remove-Item blog -Recurse https://answers.microsoft.com/en-us/windows/forum/all/i-cant-delete-folder-or-file-at-powershell-event/06540562-08db-4255-a6fa-d939ecf6f23e
  4. Can't create or delete files and folder in CMD or PowerShell

    in Windows 10 Gaming
    Can't create or delete files and folder in CMD or PowerShell: I am running Windows 11 Pro 64-bit 24H2 with the latest updates.For the past few weeks, I have been unable to create or delete files and directories in `CMD` or `PowerShell`.Example:C:\Users\MyUser>echo "some text" > new-file.txt The system cannot find the file specified....
  5. Can't create or delete files and folder in CMD or PowerShell

    in Windows 10 Software and Apps
    Can't create or delete files and folder in CMD or PowerShell: I am running Windows 11 Pro 64-bit 24H2 with the latest updates.For the past few weeks, I have been unable to create or delete files and directories in `CMD` or `PowerShell`.Example:C:\Users\MyUser>echo "some text" > new-file.txt The system cannot find the file specified....
  6. administrator permission to delete files/folders

    in Windows 10 Gaming
    administrator permission to delete files/folders: I have an Acer Predator laptop running Win 10. TI've had it for several years, and have manipulated files all over this machine with no issues. There is a folder on my desktop that I want to delete and suddenly I am apparently not allowed to do so. Windows is telling me that...
  7. administrator permission to delete files/folders

    in Windows 10 Software and Apps
    administrator permission to delete files/folders: I have an Acer Predator laptop running Win 10. TI've had it for several years, and have manipulated files all over this machine with no issues. There is a folder on my desktop that I want to delete and suddenly I am apparently not allowed to do so. Windows is telling me that...
  8. administrator permission to delete files/folders

    in Windows 10 BSOD Crashes and Debugging
    administrator permission to delete files/folders: I have an Acer Predator laptop running Win 10. TI've had it for several years, and have manipulated files all over this machine with no issues. There is a folder on my desktop that I want to delete and suddenly I am apparently not allowed to do so. Windows is telling me that...
  9. If I am the administrator How do I run as administrator to delete files

    in Windows 10 Installation and Upgrade
    If I am the administrator How do I run as administrator to delete files: If I am the administrator How do I run as administrator to delete files https://answers.microsoft.com/en-us/windows/forum/all/if-i-am-the-administrator-how-do-i-run-as/c3c58c52-4cc7-4515-8aef-b7dcae347d47
  10. Run PowerShell Script As An Administrator

    in Windows 10 Support
    Run PowerShell Script As An Administrator: Hi. So I've been searching online on a way to do this yet I cannot find a way to do it. _______________________________________ I need this in specific: I want to double click a PowerShell script file (which will run as an administrator) from Windows Explorer that has...