/build/static/layout/Breadcrumb_cap_w.png
09/27/2018 204 views

Here's my current script. If the script detects the text file in the first verify, it continues on and completes the script. I need it to do the opposite and actually stop running Task 2.  If the file does not exist, then I need it to move on to Task 2.

Verify

  1. Verify that the file “C:\Program Files (x86)\ntusernoscript.txt” exists.
    trashcan-icon.png
Reorder | Add…

On Success

  1. Log “This ntusernoscript file found. NTuser.dat script not ran.” to “status”.
    trashcan-icon.png
Reorder | Add…

Remediation

Reorder | Add…

On Remediation Success

Reorder | Add…

On Remediation Failure

Reorder | Add…

Task 2trashcan-icon.png

Attempts: 
On Failure:  Break  Continue

Verify

  1. Verify that the directory “C:\Windows\System32\WindowsPowerShell\v1.0” exists.
    trashcan-icon.png
Reorder | Add…

On Success

  1. Launch “$(KACE_SYS_DIR)\WindowsPowerShell\v1.0\powershell.exe” with params “-executionpolicy remotesigned -File $(KACE_DEPENDENCY_DIR)\NTUSER_DATE_CHANGE.ps1”.
    trashcan-icon.png
Reorder | Add…

Remediation

  1. Log “Couldn't find powershell” to “status”.
    trashcan-icon.png
Reorder | Add…

On Remediation Success

  1. Log “Powershell script ran successfully.” to “status”.
    trashcan-icon.png
Reorder | Add…

On Remediation Failure

  1. Log “Powershell script failed.” to “status”.
    trashcan-icon.png
Reorder | Add…
plus-icon.pngNew Task…
0 Comments   [ + ] Show comments

Comments



Community Chosen Answer

1
On the machines I did not want this script to run I unzipped a file to C:\Program Files (x86)\ntusernoscript.txt.
I then modified the start of my PowerShell script to search for that file and end immediately if that text file was located.

if (Test-Path "C:\Program Files (x86)\ntusernoscript.txt") {Exit 0}
Answered 10/12/2018 by: lbruschuk
White Belt

All Answers

0
Have you tried adding the second task into the first task as a remediation path, thereby removing the need for a second task?
Answered 10/01/2018 by: Hobbsy
Red Belt

0
You don't say, but, in task 1, the attempts section, On Failure, Break or Continue should be set to break.  Otherwise, yes, add task 2 to remediation if the behavior is continuing.  Verifying for PS may not be necessary but you can add that to your task 1 verify too if you need. 

I'm a little confused tho as you say you want it to continue to task 2 if task 1 verify fails.  Regardless of my confusion, you could verify if the file doesn't exist as well and play that game.

Not all parts of the task fields need to be filled out either.  They tend to be verbose enough without adding the log messages all the time.  Good for learning what part of the script is doing something tho.
Answered 10/01/2018 by: worzie
Brown Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share