RemoveFolder

Remove Shell Folder

Related Topics Link IconRelated Topics

Definition

Use this command to remove a system folder and all files contained in this folder.

The RemoveFolder command is especially meant for removing system folders (managed by the operating system) or contained folders. The command can also be used to remove any non-system directories together with the included files.
On the contrary use the RemoveDir command to remove any empty directories.

In case an error occurs when running this command, you can specify the option Stop script on error in the Script Editor. If the error actually occurs, the script stops, thus preventing subsequent errors, and the associated policy is shown as not compliant.
This also applies if you set the package property Error handling to Always terminate script on error (a default setting for new packages).

Settings

Input

When defining the system folder you want to remove, you must enter the following specifications in this command's dialog box:

  • Where to delete
    Select one of the system folders managed by the operating system. The actual paths are read from the registry key:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
  • Folder
    Specifies the name of the folder you want to delete.

Options

Computer-related link "AllUsers"
Check this option if the folder is computer-related and thus available for all users of the computer (e.g. in the All Users profile).

Delete all subfolders
Checked: The system folder, all files residing in the system folder and all subfolders will be deleted.
Not checked: The system folder and all files residing within will be deleted only if the system folder does not contain subfolders.

Disable file redirection on x64 machines 
For reasons of compatibilty, Ivanti DSM maps file and registry access to the default storage location for 32 bit applications (provided that the storage location differs from that of 64-bit applications). File access: whenever a 32-bit application attempts to access %windir%\System32, the access is redirected to %windir%\SysWOW64. Registry commands: when accessing HKEY_LOCAL_MACHINE\SOFTWARE the calls are redirected to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node. The x64-switch stops this redirection of file and registry accesses when running the script command on a x64 computer; the eScript command runs on the specified path. CallScript command: the script runs in a 64-bit process.