Using ZENworks for Servers to Delete Directories on Servers
Novell Cool Solutions: Feature
By Dale Asay
Digg This -
Posted: 7 Sep 2005
If you want to delete certain directories from a number of different network servers (NetWare, Windows*, Linux*, and Solaris*), you normally may not have an automated method for performing this task. However if you are using Novell ZENworks for Servers (ZfS) 3 Policy and Distribution Services, the Server Software Packages feature of ZfS provides the capability for you to delete specified directories from any Subscriber server's file system.
To automate the deletion of specified directories on multiple servers, you will first set up path variables (if necessary), create a Server Software Package in its namespace in ConsoleOne, compile the software package, then distribute the package using Tiered Electronic Distribution (TED). No further user intervention will be required.
Setting Up Variables for Use With the Server Software Package
Before you create the software package, if you will be using variables in paths, such as if your target servers have different operating systems (like NetWare and Windows), you must set up the variables in your Subscriber objects' properties.
- Identify the directories to be deleted:
- Identify the root of the path, such as its volume name (NetWare), drive letter (Windows), or /usr (for Linux and Solaris). For example, DATA:.
- Identify the rest of the path, including the parent directory to the directories to be deleted, such as ZENWORKS\PDS\TED\DIST where DIST is the parent directory.
- Identify the directories to be deleted, such as OldDistribution.TED.ZfS3.Novell. The resulting full path and directory to be deleted would be: DATA:\ZENWORKS\PDS\TED\DIST\OldDistribution.TED.ZfS3.Novell You may have varying path elements from server to server. You should use variables as necessary to allow for those differences (see Steps 2 and 3).
- In ConsoleOne, create a variable to represent DATA:, D:, or /usr for each Subscriber where the directories to be deleted reside, such as DELETEDDIRROOT.
If you name a directory to be deleted that does not exist on a target server, nothing will be done for that directory on that server.
You can also define variables globally using the Tiered Electronic Distribution policy, where you would define the default value for a variable and allow the exceptions to be defined in the applicable Subscriber objects' properties.
- In ConsoleOne, create a Subscriber variable to represent where any path elements are different. If you have an extra directory between the root of the drive on your Windows servers (such as ZFS3), you will need to create a variable on all of your target Subscriber servers for that part of the path. For example, if your Windows servers have ZFS3\ZENWORKS at the root of the D: drive, and your NetWare servers have only ZENWORKS at the root of the DATA: volume, create a variable (such as %TARGET%) to represent ZFS3\ZENWORKS on your Windows Subscribers and ZENWORKS on your NetWare Subscribers.
- Repeat Steps 2 and 3 as necessary.
Creating the Server Software Package
You first need to create the Server Software Package object in its namespace.
- In ConsoleOne where the ZfS 3 snap-ins have been installed, in the left pane right-click the Server Software Packages namespace.
- Click File > New > Software Package. The Create New Server Software Package wizard is started.
- Click Next.
- Enter a name for the software package, such as Delete Old Directories.
- Specify a path and filename for the software package template file (.SPK), such as C:\TEMP\DELETEDIRS.SPK.
IMPORTANT: If you save your .SPK file to a network server, use a UNC path so that you will still have access to that software package file should your drive letters change. Also, you can save your .SPK files to a workstation or server, because their file sizes do not become large. For this particular type of software package (where you are only giving instructions for deleting directories and are not compiling data files), when you later compile the .SPK file, the .CPK (compiled software package) version will be similar in size (not very large). Therefore, for management purposes, you may want to save these .SPK files and their corresponding .CPK files in the same location, which can be on a workstation or server.
- Click Finish.
- Click the plus sign to expand the Server Software Package namespace to view the new package named Delete Old Directories.
Unless otherwise instructed, steps in the subsequent sections should be performed from the same instance of ConsoleOne you used in the above steps, because your .SPK files will be accessible from there.
Configuring the Server Software Package
The software package has three properties that you can configure: Description, Requirements, and Variables. You do not need to configure any of these Server Software Package object properties. However, you do need to create and configure a component for the package.
- Right-click the Delete Old Directories software package object and select New Component.
- Enter a name for the component, such as Delete Directories.
- Click the plus sign to expand the Server Software Package object.
- Right-click the component and select Properties.
- Click the Copy File tab.
- Click the drop down list button and select Add File Group.
- Click Add.
- Enter a name for the file group, such as Delete Working Directories.
- In the Group Target Path field, enter the name of the variable that you created containing the location of the directories to be deleted.
For example, if the location for the directories to be deleted is the same for all target servers, enter the actual volume/path (NetWare) or drive/path (Windows).
However, if you need to use variables because the server operating systems are different, then enter the variable name (within the % symbols) and enter the full path (which can also contain variables) to the directory that will contain the directories to be deleted. For example, %DELETEDDIRROOT% (variable name) and %TARGET%\PDS\TED\DIST (full path to the parent directory of the directories you want to delete).
IMPORTANT: When using variables, the path you enter must be the directory containing the directory to be deleted. In a later step you will add the actual directory names to be deleted.
- Click OK.
- Click the drop-down list button and select Add Directory.
- Click Add.
- Enter the name of the directory to be deleted, such as OldDistribution.TED.ZfS3.Novell.
WARNING: If you want to delete the OldDistribution.TED.ZfS3.Novell directory, do not enter its parent directory (DIST in our examples), or that parent directory will also be deleted.
- Click the drop-down list button next to the Copy Mode combo box and select Delete.
- Click OK.
- Repeat Steps 6 through 15 for each directory you want this software package to delete.
Using the examples from the above steps, you would have entered:
%DELETEDDIRROOT% and %TARGET%\PDS\TED\DIST and OldDistribution.ZfS3.TED.Novell
in order to delete the directories having these paths:
Compiling the Server Software Package
You now have an .SPK file that serves as the template for what you want to delete. You must now compile this .SPK file into a .CPK file.
- Right-click the software package, such as Delete Old Directories.
- Select Compile.
The Compile Software Package wizard starts.
- Click Next on the first page of the wizard.
- Enter the full path and filename for the .CPK file that you will be generating.
IMPORTANT: Do not use the .SPK extension for this filename, or your template file could be overwritten by its compiled version if they are stored in the same location. This would prevent you from being able to make further edits to the software package. You can use the same filename, such as DELETEDIRS, but you should use only the .CPK filename extension.
Also, for this particular software package (where you only delete directories), the location for .CPK files does not need to be where you have ample storage for very large files (in hundreds of megabytes per file), as you normally would for .CPK files.
- Click Next, then click Finish.
Manually Testing That the Directories Have Been Deleted
The software package is now ready for sending as a Software Package type of Distribution. However, for testing, you can manually process the software package on one of the target servers to determine that the directories were deleted as intended.
- On a server where you want to delete a directory, create a directory named OldDistribution.TED.ZfS3.Novell under ZENWORKS\PDS\TED\DIST.
If you created your software package using real directory names, make sure those exist instead in the paths you specified.
- Copy the DELETEDIRS.CPK file to the TEMP directory on that server.
- At the server's console prompt, enter the PACKAGE PROCESS command to process the software package. For example, if it was a NetWare server, you would enter: package process data:\temp\deletedirs.cpk
ZfS will process the package and report that it has finished processing. Check the server's file system to see that the OldDistribution.TED.ZfS3.Novell directory, or the directories you specified, were deleted.
After you are satisfied with the result of your test, you can distribute the DELETEDIRS.CPK file using TED to all your target Subscriber servers with your new Software Package Distribution that will delete directories on your Subscriber servers' file systems.
Novell, Inc. makes no representations or warranties with respect to the contents or use of this documentation, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes.
Further, Novell, Inc. makes no representations or warranties with respect to any software, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to make changes to any and all parts of Novell software, at any time, without any obligation to notify any person or entity of such changes.
You may not export or re-export this product in violation of any applicable laws or regulations including, without limitation, U.S. export regulations or the laws of the country in which you reside.
Copyright - 1999-2002 Novell, Inc. All rights reserved. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of the publisher.
U.S. Patent Nos. 5,910,803; 6,067,093. Patents Pending.
NetWare is a registered trademark of Novell, Inc. in the United States and other countries.
Novell is a registered trademark of Novell, Inc. in the United States and other countries.
ZENworks is a registered trademark of Novell, Inc. in the United States and other countries.
* All third-party trademarks are the property of their respective owners.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com