Deleting a file based on currently logged on user

(imported topic written by cfreed91)

I am a noob to bigfix and action scripting and I must be missing something. I have been racking my brain trying to figure out how to simply delete a file/files based on vbs extension. I would think/hope it would be as simple as the following command in the action script but I cannot get this to work. I have tried both of the following commands.

dos del “C:\Users%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup*.vbs”

delete “C:\Users%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup*.vbs”

Please note the %USERNAME variable. I’m thinking this my prob. Can someone let me knowwhat i’m doing wrong?

(imported comment written by cstoneba)

you need to insert relevancy in the place of the %username% variable. Note that this will only work for the current user that is logged on to the endpoint. if you want it to recursvily go through all users profile folders and delete *.vbs in them, that is a little more dificult, but still doable.

this is what I would do:

relevance:

-exists logged on user

-exists files whose (name of it as lowercase contains “.vbs”) of folder (“C:\Users” & (name of logged on user) & “\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup”

action:

waithidden cmd.exe /c del /Q /F “C:\Users” & {name of logged on user} & “\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup*.vbs”

(imported comment written by cfreed91)

Ok I set the relevancy code as so:

exists logged on user AND exists files whose (name of it as lowercase contains “*.vbs”) of folder (“C:\Users” & (name of logged on user) & “\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup”)

and the action I copied directly from your post. From the console I told it to apply only to my computer. got the offer and everything ran fine butthe VBS files still exist. Did I do the relevancy code incorrectly.

(imported comment written by Kanboo)

Hey Bob: I just dropped the script you sent me (thks)and got this with no success:

// only run if a user is logged in

continue if {exists current user}

waithidden cmd.exe /C net localgroup administrators aa{name of current user} /delete

(Got the execution detail screen attached)

Am I missing something? Thks