Script to delete all photoshop temp files older than 2 days - photoshop

I have this commen issue with photoshop. Where it doesn't delete the temp files it creates after a shutdown of program.
I have used alot of time to find a script that would delete all files with starting name of Photoshop* in the temp, which is older than 2 days. So i dont delete files, if i get a unexpected shutdown or crash.
I tried this, after a few hours of search - but it doenst work
ForFiles /p "C:\Users\user\AppData\Local\Temp\Photo*" /s /d -2 /c "cmd /c del #file"
This works, perfectly but it deletes all files without taking into consideration how old the files are.
C:\
del "C:\Users\user\AppData\Local\Temp\Photoshop*."
How can i get the above script, which runs on every startup with system rights.
To only delete all files starting with photoshop* and are older than 2 days :)
I need this script to work on Windows10 and Windows7
Every input is appreciated.

Related

Robocopy fails with security error copying "from nas to nas". Why?

tl;dr
robocopy has security problems copying from 'nas to nas'
The system detected a possible attempt to compromise security. Please
ensure that you can contact the server that authenticated you.
Summary
I'm running into "windows permission problems" when making backups using using the following:
powershell
robocopy
Windows 2008R2
Windows task scheduler
Task Scheduler output
Taskscheduler runs under user domain account "OPS\backupuser"
The script succeeds when it copies "from local drive" "to the backup nas"
However it fails when the script copies "from another nas" "to the backup nas"
In pictures...
Success: local drive --copy-to--> backup NAS
Fails: another NAS --copy-to--> backup NAS
Output
Robocopy fails with exit code 16.
Here is detailed output:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Thu Jul 07 22:22:11 2016
2016/07/07 22:22:26 ERROR 1265 (0x000004F1) Getting File System Type of Source \\app-data-nas.hosting.acme\bazapp$\production\foo_industries_prod\
The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.
Source - \\app-data-nas.hosting.acme\bazapp$\production\foo_industries_prod\
Dest : \\dr-backup-nas\AppDR$\ALL_DR\FOO_INDUSTRIES_DR\foo_industries_prod\
Files : *.*
Options : *.* /NDL /S /E /COPY:DT /PURGE /MIR /B /NP /R:0 /W:1
------------------------------------------------------------------------------
Other points
1) Because I the environment is 'locked down', I could not run this from the command line, either as :
my own account
my own account with elevated command prompt
OPS\backupuser
2) I tried adding '/NODCOPY' , but robocopy failed; apparently we don't have the hotfix for this option.
Thanks in advance!
NAS drives are not Windows drives. You have to map to them uniquely and with certain admin privileges to make them "see" you're trying to copy stuff into them.
First map a drive to the NAS system using NET USE
Next copy the file(s) using ROBOCOPY thus...
robocopy <source path> <nas path> <file(s)> /s /j /r:2 /w:5 /log+:robocopy.log
Place it all inside a CMD file and run it from a Task Scheduler on your Windows server.
>
>
>NAS drives are not Windows drives. You have to map to them uniquely and with certain >admin privileges to make them "see" you're trying to copy stuff into them.>
>
>First map a drive to the NAS system using NET USE
>
>Next copy the file(s) using ROBOCOPY thus...
>
>robocopy <source path> <nas path> <file(s)> /s /j /r:2 /w:5 /log+:robocopy.log
>Place it all inside a CMD file and run it from a Task Scheduler on your Windows server.
>
You forgot:
/FFT #":: assume FAT File Times (2-second granularity)" -ensures the copy ignores OS file system while copying in ROBOCOPY
/Z #":: Includes LARGE file copy restart" - restarts large file copying where the copy left off in the file, instead of starting over again. Like in a 500 GB file it restarts at the byte the copy stopped at, in case you need to schedule offline copying and don't want large files to prevent the copy progression (will ONLY start over if the file date changed!)
/xo #"exclude older files" -copies all new files - something useful to retry copies in Scheduled task Job of Robocopy...
All these are useful in NAS copying... as they tend to have issues resolved by these switches in ROBOCOPY.

robocopy /b access denied

I'm going nuts over Robocopy. I want to create a 1:1 exact copy (including data, and permissions of each file & folder) of two local volumes. Actually, they are located on different physical HDD's. Say I have A:\ and B:\. I just want to copy all of the stuff from A:\ to B:\.
So, I tried this command:
robocopy A:\ B:\ /e /b /copyall /dcopy:T
But I keep getting access denied errors. Same results with /zb switch. I am using elevated/admin privileges in Win7 to run the Robocopy commands in command prompt.
I found a Microsoft hotfix, which fails to install on my machine, not sure if it would remedy my problem (KB979808).
I don't know if the problem is the commands, Robocopy itself, or the operating system.
Any ideas?
For whatever reason, right-clickind and running the command as Administrator doesn't work, but if you go into safe mode, the command works fine - you have admin rights.

creating bat file to start multiple applications if not already running - task scheduler

I am trying to set up a task that executes a bat file that will start up a bunch of processes if not already running. I found some examples and tried to put it together but it does not seem like it worked. I would like to set this up on a windows 2008 server and these are all visual studio 2010 vb.net applications.
#echo off
:start
set /p runningprocess="C:\Users...Debug\PROCESS_I.exe"
tasklist /FI "IMAGENAME eq %runningprocess%" | find /I "%runningprocess%" > nul
IF %ERRORLEVEL% equ 0 ECHO PROCESS_? is running
IF %ERRORLEVEL% equ 1 ECHO PROCESS_? is not running
pause>nul
goto start
exit
How can I adapt this to run multiple processes:
set /p runningprocess="C:\Users...Debug\PROCESS_II.exe"
set /p runningprocess="C:\Users...Debug\PROCESS_III.exe"
The task should be able to fire up every 1 or 2 hours to check if processes are already running and if not start new ones. This is my backup plan for making sure my processes will always be running in the event of some failure which I can be alerted by emails from within each application.
Any ideas appreciated.
EDIT: just checked task schedule for last run result and it says "the directory name is invalid"
this is in program/script:
"C:\Users\...\BatchProcesses\PTTrackProcesses.bat"
and this is in start in
C:\Users\...\BatchProcesses\
ERROR when running manually
C:\Users\..Debug\PROCESS_I.exe
ERROR: The search filter cannot be recognized.
PROCESS is not running
ok figured it out. Made changes as in comment above and changed the script a little.

run a command line entry in windows xp on login

I am having issues with credentials being cached on a few of the laptops that area available to students at my university.
I have found that if i remove (remove not edit to NULL) a registry entry at
HKEY_CURRENT_USER\Software\Microsoft\EAPOL\UserEapInfo
this solves the problem.
Im also pretty sure that this will delete the registry entry through the command line
REG DELETE HKEY_CURRENT_USER\Software\Microsoft\EAPOL\UserEapInfo /f
What I need to know is how to make this line run when the machine is logged into.
A Scheduled Task maybe what you are looking for:
save your command into a .bat file somewhere
Go to Control Panel > Scheduled Tasks > Add Scheduled Task
config the scheduled task to run your .bat file, and schedule it to run "when I logon"

NTBackup problems on shutdown

I'm trying to lunch ntbackup on shutdown but the backup file (.bkf) is only 1.1 GB instead of 2.2 GB. When i try to restore using this file ntbackup tells me that it is corrupted. If i run the same command as bat file it works (the command is: ntbackup backup C:\ systemstate /m normal /f "X:\Backup_20-12-2010.bkf" /j "Bckp_Data-and-System" /L:s ). The log file tells me that everything is ok. What can i do?
The solution is to set in gpedit.msc at Computer Configuration\Administrative Templates\System\Scripts the key Maximum wait time for Group Policy scripts to 0. The default time is 600 seconds (10 minutes).