The important part to notice is the Operating System selection, in which if anything else is chosen but just the Microsoft Windows then K1000 does not show option Run Batch file. If you have chosen Operating System with fine grain detail, this does not work, the setting has to be the general targeting to Microsoft Windows -systems.
The selector /S enables RMDIR command to remove the folder and any subfolders and contents within. Selector /Q enables the command to run quietly without prompting the user.
- Go to Scripting | Scripts and select Choose Action: New
- Provide a name. For example: Delete Folder
- Select the Enabled checkbox
- Select Online KScript from the Type dropdown menu
- Select Production from the Status dropdown menu
- Provide a summary of the script purpose in the Description field. For example: "Script to delete C:\foldername\foldername -folder and everything in it."
- Optional: provide some more detailed information in the Notes field
- In the Deploy section, configure the script to reflect the client environment
- This script is suitable for individual managed machines, use the Devices field to select the IP Addres(ses).
- In the Deploy section, configure the following settings for the Operating System:
- Clear the Select Specific Operating System checkbox, if checked, and select Microsoft Windows.
- Leave the Schedule settings as default and unchanged. The None setting is selected by default.
- No dependencies will be used in this script.
- Under the Task section, select New Task
- Leave the following settings by default:
- Attempts: 1
- On Failure: Break
- Under Verify, select Add and choose: Verify a directory exists...
- Enter the directory path in the Directory field, for example: c:\folder\subfolder
- Select Save Changes
- Under On Success, select Add and choose: Launch a program...
- Directory: %SYSTEMROOT%
- File: cmd /c
- Select the Wait for completion checkbox
- Parameters: rmdir c:\folder\subfolder /s /q
- Select Save Changes
- Select either Save or Run Now
- Selecting Run Now will present a confirmation to save the script before executing the script.