Run bleachbit_console in "Unattended mode"

Forums: 

I'm having a weird issue with the following powershell script,
pretty simple stuff to launch bleachbit console,
clean some crap and logs everything it does.

$logTime = (Get-Date).ToString("dd-MM-yyyy_HH-mm-ss")
$bleachbitCmd = "C:\test\BleachBit-Portable\bleachbit_console.exe"
$bleachbitLog = "C:\test\BleachBit_log-$logTime.log"
cmd /C "$bleachbitCmd -p -o --preset" | Out-file $bleachbitLog

This works fine if I launch with user logged in windows session.
If I launch in the system context or without a desktop session running, it hangs until timeout doing nothing (empty logs).
Is there any way I can run bleachbit_console unattended without desktop session within system context?
thanks

BleachBit version 4.0.0
Build number 1628
GTK version 3.18.9

BleachBit version: 
4.0.0
Your operating system: 
Windows 10

For troubleshooting, what if you replace --preset with something like internet_explorer.cache in case it is related to a specific cleaner? One special case is system.clipboard which requires the user interface. Another special cache are many cleaners that required administrator privileges.

How do you launch it in the system context or without a desktop session running? Do you use Windows Task Scheduler?

Could you run it in the user context with the desktop session running?

---
Andrew, lead developer

Ok I've tried with just a few cleaners and it runs !!
the line
cmd /c "$bleachbitCmd -p adobe_reader.* firefox.cache microsoft_office.* system.tmp" | Out-file $bleachbitLog
works. There is something related to specify cleaners, I've read most of the docs but I coundn't remember anything about cleaner permission, is there anything about ? How can I troubleshoot ?

For the system context I use "psexec.exe -i -s powershell.exe" and also tried with the windows task scheduler.

Yes in user context with desktop sessions the original runs fine.
I have an additional question; is there a way to clean every local profile, not just the running user ?
Thanks

There is something related to specify cleaners, I've read most of the
docs but I coundn't remember anything about cleaner permission, is there
anything about ? How can I troubleshoot ?

I would start by cleaning user applications such as web browsers, Adobe Reader, Flash, Microsoft Office: these should work fine. These clean stuff under %userprofile%. If you examine the CleanerML (xml) files, you will notice they reference %userprofile%, %appdata%, %localappdata%, and HKCU (registry hive).

Windows Explorer thumbnails might not work because it launches taskkill.exe and explorer.exe . (You can see this in its XML file.)

I would avoid cleaning system.clipboard and system.free_disk_space.

I have an additional question; is there a way to clean every local profile, not just the running user ?

As of BleachBit 4.0.0, there is nothing built in. Some options are

1. Use psexec to switch to the other users' contexts
2. Run as a logon script for each user
3. Use Windows Task Scheduler to run as each user

---
Andrew, lead developer