Too large for a comment on the win32 variant, therefore:
Win32 api variant works perfectly from a scheduled task on Server 2022 (if run when user is logged on). Here is the "one line for task scheduler" variant, obeying the quotation-quirks when calling it that way. Advantage: Does not need an external script, just that task. Just set YOUR path at the end of that looong line.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& {$SWP = 'using System.Runtime.InteropServices; public class wallpaper {public const int SetDesktopWallpaper = 20;public const int UpdateIniFile = 0x01;public const int SendWinIniChange = 0x02;[DllImport('+[char](34)+'user32.dll'+[char](34)+', SetLastError = true, CharSet = CharSet.Auto)] private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);public static void SetWallpaper ( string path ) {SystemParametersInfo( SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange );}}'; Add-Type -TypeDefinition $SWP;[wallpaper]::SetWallpaper('C:\scripts\Data\today-inv.png')}"
Thanks to @ClumsyPuffin and @mwfearnly !