Solved A PowerShell question


TechnoMage2021

Retired PC Builder/Tech
Power User
VIP
Local time
6:08 AM
Posts
1,001
Location
Central Florida, USA
OS
Win-11/Pro/64, Optimum 11 V3, 23H2 22631.3085
While writing my Win11Cleanup.bat program, I wanted a line of code that would empty out my Recycle Bin.
A most helpful member gave me this line:
PowerShell Clear-RecycleBin -DriveLetter C -force -ErrorAction:Ignore

It works GREAT on the little PC that I'm on now, (Running Windows 11/Pro/64, ver. 22H2, Build 22621.963.)
But, on another PC, that I just put together and installed the same ver. of Win-11 on, (from the same Flash Drive) that same line of code, in the same batch file does not empty the Recycle Bin at all. (n) I see a little flash on the screen when that line executes, but the Recycle Bin is NOT emptied.

So I guess my question is, "What gives?".
Is some 'Service' missing on the second PC?
And what can I do to get that line of code working as it should on the second PC?
Help! Help!

TM :cool:
 

My Computer

System One

  • OS
    Win-11/Pro/64, Optimum 11 V3, 23H2 22631.3085
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Made w/Gigabyte mobo/DX-10
    CPU
    AMD FX 6350 Six Core
    Motherboard
    Gigabyte, DX-10, GA-78LMT-USB3
    Memory
    Crucial, 16 GB
    Graphics Card(s)
    Onboard, ATI Radeon HD 3000; NVIDEA GeForce 210, 1GB DDR3 Ram.
    Sound Card
    Onboard
    Monitor(s) Displays
    24" Acer
    Screen Resolution
    1280x800
    Hard Drives
    Crucial SSD 500GB, SanDisk 126GB SSD, Toshiba 1TB HD
    PSU
    EVGA 500 W.
    Case
    Pac Man, Mid Tower
    Cooling
    AMD/OEM
    Keyboard
    101 key, Backlit/ Mechanical Switches/
    Mouse
    Logitech USB Wireless M310
    Internet Speed
    Hughes Net speed varies with the weather
    Browser
    Firefox 64x
    Antivirus
    Windows Defender, Super Anti Spyware
    Other Info
    Given to me as DEAD, and irreparable.
    Rebuilt with Gigabyte mobo, AMD cpu, 16GB ram and 500GB Crucial SSD.
I suggest you run that PS command in a PS window on its own to see what the response is.

I suspect the code came from Option 5 of
Empty Recycle Bin for all users - TenForumsTutorials
and I don't think there's an equivalent ElevenForum tutorial yet.

Best of luck,
Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3296

My Computer

System One

  • OS
    W11 Home
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build Date: March 2022
    CPU
    Intel Core i9-13900KF
    Motherboard
    ASUS Prime 690-P
    Memory
    DDR5 32GB (2x16GB) DDR5 4600
    Graphics Card(s)
    RTX 4080 12GB
    Screen Resolution
    1920 x 1080 (scaled 125%) (144Mhz Refresh Rate)
    PSU
    1000 Watt
    Cooling
    AIO
    Internet Speed
    1GB
    Browser
    Chrome and Edge
    Antivirus
    Malwarebytes Premium
I am not conversant in the use of Power Shell. I barely skate by with DOS Batch Files.

But,for that Power Shell command to run in a Batch File, what needs to be present. Something I'm obviously missing?
 

My Computer

System One

  • OS
    Win-11/Pro/64, Optimum 11 V3, 23H2 22631.3085
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Made w/Gigabyte mobo/DX-10
    CPU
    AMD FX 6350 Six Core
    Motherboard
    Gigabyte, DX-10, GA-78LMT-USB3
    Memory
    Crucial, 16 GB
    Graphics Card(s)
    Onboard, ATI Radeon HD 3000; NVIDEA GeForce 210, 1GB DDR3 Ram.
    Sound Card
    Onboard
    Monitor(s) Displays
    24" Acer
    Screen Resolution
    1280x800
    Hard Drives
    Crucial SSD 500GB, SanDisk 126GB SSD, Toshiba 1TB HD
    PSU
    EVGA 500 W.
    Case
    Pac Man, Mid Tower
    Cooling
    AMD/OEM
    Keyboard
    101 key, Backlit/ Mechanical Switches/
    Mouse
    Logitech USB Wireless M310
    Internet Speed
    Hughes Net speed varies with the weather
    Browser
    Firefox 64x
    Antivirus
    Windows Defender, Super Anti Spyware
    Other Info
    Given to me as DEAD, and irreparable.
    Rebuilt with Gigabyte mobo, AMD cpu, 16GB ram and 500GB Crucial SSD.
I've poked, prodded, and twiddled with that batch file, till I finally have it emptying the Recycle Bins, all of them. At least on that one PC.
And that one PC was the only one I was having problems with.
Thanks for all the helps.

TM :cool:
 

My Computer

System One

  • OS
    Win-11/Pro/64, Optimum 11 V3, 23H2 22631.3085
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Made w/Gigabyte mobo/DX-10
    CPU
    AMD FX 6350 Six Core
    Motherboard
    Gigabyte, DX-10, GA-78LMT-USB3
    Memory
    Crucial, 16 GB
    Graphics Card(s)
    Onboard, ATI Radeon HD 3000; NVIDEA GeForce 210, 1GB DDR3 Ram.
    Sound Card
    Onboard
    Monitor(s) Displays
    24" Acer
    Screen Resolution
    1280x800
    Hard Drives
    Crucial SSD 500GB, SanDisk 126GB SSD, Toshiba 1TB HD
    PSU
    EVGA 500 W.
    Case
    Pac Man, Mid Tower
    Cooling
    AMD/OEM
    Keyboard
    101 key, Backlit/ Mechanical Switches/
    Mouse
    Logitech USB Wireless M310
    Internet Speed
    Hughes Net speed varies with the weather
    Browser
    Firefox 64x
    Antivirus
    Windows Defender, Super Anti Spyware
    Other Info
    Given to me as DEAD, and irreparable.
    Rebuilt with Gigabyte mobo, AMD cpu, 16GB ram and 500GB Crucial SSD.

Latest Support Threads

Back
Top Bottom