Need Help Writting Custom Actions and Relevance!

(imported topic written by Mr.Smith91)

I am interested in creating a couple custom Fixlets to create Scheduled Tasks in Windows.

The relevance needs to be for Windows XP and to check to see if the is already a .job file with a certain name in the Task Scheduler folder(C:\Windows\tasks). The action is 2 separate command line prompts, one to schedule a Disk Cleanup and one to schedule a Disk Defrag. The action also needs to include the writing of a few new registry keys.

I have complied the command line prompts and needed registry strings and values which are attached in a notepad file. I don’t know a lot about writing scripts so i am having trouble at this point in the process. If someone could please help me out that would be very much appreciated. Thank you so much!

(imported comment written by BenKus)

Hey Smith,

This can hopefully get you started… I would suggest you make two Fixlets…

Fixlet 1: Scheduled Tasks

Relevance:

not exists file “DiskDefrag” of folder “Tasks” of windows folder AND not exists file “CleanMgr” of folder “Tasks” of windows folder

Actionscript:

waithidden cmd.exe /C schtasks /create /tn DiskDefrag /sc WEEKLY /mo 2 /d SUN /st 02:30:00 /ru “System” /tr “”%systemroot%\system32\defrag.exe" C:"

waithidden cmd.exe /C schtasks /create /tn CleanMgr /sc WEEKLY /mo 2 /d SUN /st 02:00:00 /ru “System” /tr “”%systemroot%\system32\Cleanmgr.exe" Sagerun:1"

Fixlet 2: Detect Improper Registry Volume Cache Settings

exists value “StateFlag” whose (it as integer != 0) of keys (“Downloaded Program Files”;“Internet Cache Files”;“Recycle Bin”;“Temporary Files”;“WebClient and WebPublisher Cache”;“Compress old files”;“Content Indexer Cleaner”;“Offline Page Files”) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches” of registry

Actionscript:

regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\WebClient and WebPublisher Cache” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Compress old files” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Content Indexer Cleaner” “StateFlag”=dword:00000000
regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Page Files” “StateFlag”=dword:00000000

I didn’t test this, but you can use the Fixlet Debugger at: http://support.bigfix.com/fixlet/ to test out the components and make sure they do what you want…

Ben