Page 1 of 1

SDelete with Uninst_UVK_AtLogon.uvk

Posted: Thu Jul 30, 2015 5:47 am
by wrc559
Hey,

I wanna be able to remove the content of a folder or the whole folder (Full of repair tools) when the PC is restarted. Is it possible to perform this after PC reboot # 2, or only after the first PC reboot?

This was my current attempt... with no luck - which follows on from Fred's UVK command.

<UVKCommandsScript>
<RunWait> -h
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART /rl HIGHEST /delay 0005:00 /f
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "<SDelete> %Desktop%\Repair Tool Software"

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Thu Jul 30, 2015 5:48 am
by wrc559
Wait, I think I found out, Trying to run a UVK command through the SchTasks.. Anyway, if someone can assist me in my project that would be awesome :)

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Thu Jul 30, 2015 6:15 am
by Charger440
I need to go to bed but here is the best hint I can find at the moment.... From MSDN:

/SC schedule

A value that specifies the schedule frequency. Valid values are: MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONLOGON, ONIDLE, and ONEVENT.


ONSTART is not listed in the /SC params, it's actually in the /MO params

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Thu Jul 30, 2015 9:23 am
by Fred
WRC, <SDelete> is a UVK scripting keyword, and thus is only understood by UVK. Windows does not recognize it.

Replace the last command with this one:

Code: Select all

%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%Desktop%\Repair Tool Software'"
Don't forget the quotes around %Desktop%\Repair Tool Software. They're needed there.

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Thu Jul 30, 2015 12:57 pm
by wrc559
Fred wrote:WRC, <SDelete> is a UVK scripting keyword, and thus is only understood by UVK. Windows does not recognize it.

Replace the last command with this one:

Code: Select all

%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%Desktop%\Repair Tool Software'"
Don't forget the quotes around %Desktop%\Repair Tool Software. They're needed there.
Thank you, I appreciate your help.

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Mon Aug 03, 2015 12:51 am
by wrc559
Can't understanndddd coddesss, or i just did it all wrong.... Trying to schedule automatic UVK uninstall & software folder. UVK uninstalls, however files wont delete.
Still trying to get the system to delete files Automatically:


<UVKCommandsScript>
<RunWait> -h
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART /rl HIGHEST /delay 0005:00 /f
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%Desktop%\Repair Tool Software'"
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%MyDocs%\Downloads\Repair Tool Software'"
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%MyDocs%\Downloads\Repair Tool Software.zip'"
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%UserProfile%\Downloads\Repair Tool Software'"
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%UserProfile%\Downloads\Repair Tool Software.zip'"
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%UserProfile%\Downloads\Repair _Tool_Software'"
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%UserProfile%\Downloads\Repair_Tool_Software.zip'"

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Mon Aug 03, 2015 1:56 am
by Charger440
"/SC" does not have the value, "ONSTART." "/TN" is supposed to be a unique identifier and you are repeating the name several times therefore not making it unique.

This is according to MSDN documatation.

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Mon Aug 03, 2015 9:18 am
by Fred
Jim, this is taken from a Windows command prompt help file in CHM format I downloaded from Microsoft.

Syntax:

Code: Select all

schtasks /create /sc <ScheduleType> /tn <TaskName> /tr <TaskRun> [/s <Computer> [/u [<Domain>\]<User> [/p <Password>]]] [/ru {[<Domain>\]<User> | System}] [/rp <Password>] [/mo <Modifier>] [/d <Day>[,<Day>...] | *] [/m <Month>[,<Month>...]] [/i <IdleTime>] [/st <StartTime>] [/ri <Interval>] [{/et <EndTime> | /du <Duration>} [/k]] [/sd <StartDate>] [/ed <EndDate>] [/it] [/z] [/f]
Parameters

Code: Select all

/sc <ScheduleType>
Specifies the schedule type. Valid values are MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE.
Thus the ONSTART value is valid for /SC. As for /TN, you're absolutely correct, and I didn't spot that one.

Jono,

You need to give each task a different name, except for the Uninstall UVK on startup ones. Those have the same name for this command to work on XP.

Additionally, you are using the RD (rmdir) command to delete files. That won't work. RD only removes folders. Use DEL /F /Q 'File Path' instead, for files.

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Mon Aug 03, 2015 9:38 am
by Fred
I also noticed the file and folder removal commands don't have the /SC and /RU parameters (my fault, I guess).

Code: Select all

<UVKCommandsScript>
<RunWait> -h
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART /rl HIGHEST /delay 0005:00 /f
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup" /tr "%ComSpec% /c rd /s /q '%Desktop%\Repair Tool Software'" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup 2" /tr "%ComSpec% /c rd /s /q '%MyDocs%\Downloads\Repair Tool Software'" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool zip On Startup" /tr "%ComSpec% /c del /f /q '%MyDocs%\Downloads\Repair Tool Software.zip'" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup 3" /tr "%ComSpec% /c rd /s /q '%UserProfile%\Downloads\Repair Tool Software'" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool zip On Startup 2" /tr "%ComSpec% /c del /f /q '%UserProfile%\Downloads\Repair Tool Software.zip'" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool Folder On Startup 4" /tr "%ComSpec% /c rd /s /q '%UserProfile%\Downloads\Repair _Tool_Software'" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Delete RepairTool zip On Startup 3" /tr "%ComSpec% /c del /f /q '%UserProfile%\Downloads\Repair_Tool_Software.zip'" /ru System /sc ONSTART
The main problem with this code is that it will create several tasks and leave them in the system. Windows will run those tasks every time the system boots. Uninstall UVK on startup is not important, because UVK_en.exe no longer exists, but %Comspec% does exist, so it will be executed, increasing boot time.

I would remove those files immediately, instead, unless you have a problem with it.

Code: Select all

<UVKCommandsScript>
<RunWait> -h
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART
%SystemDir%\schtasks.exe /create /tn "Uninstall UVK on startup" /tr "'%UVKDir%\UVK_en.exe' -Uninst -Auto" /ru System /sc ONSTART /rl HIGHEST /delay 0005:00 /f

%ComSpec% /c rd /s /q "%Desktop%\Repair Tool Software"
%ComSpec% /c rd /s /q "%MyDocs%\Downloads\Repair Tool Software"
%ComSpec% /c del /f /q "%MyDocs%\Downloads\Repair Tool Software.zip"
%ComSpec% /c rd /s /q "%UserProfile%\Downloads\Repair Tool Software"
%ComSpec% /c del /f /q "%UserProfile%\Downloads\Repair Tool Software.zip"
%ComSpec% /c rd /s /q "%UserProfile%\Downloads\Repair _Tool_Software"
%ComSpec% /c del /f /q "%UserProfile%\Downloads\Repair_Tool_Software.zip"

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Mon Aug 03, 2015 9:47 am
by Fred
You guys can download the Windows command line reference here:
https://www.microsoft.com/en-us/downloa ... px?id=2632

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Tue Aug 04, 2015 4:10 am
by Charger440
Fred

I did not realize you wrote the code that Jono was trying to get to work. To be honest with you it never occurred to me too download the windows command line documentation as I was looking at the MSDN documentation which should be newer. In this case it seems as though it was wrong though.

Glad you got it figured out for Jono though :)

Re: SDelete with Uninst_UVK_AtLogon.uvk

Posted: Wed Aug 05, 2015 7:40 am
by wrc559
Thank you;
Appreciate your support