Skip navigation links


com.thortech.xl.util.adapters
Class tcUtilPSTools

java.lang.Object
  extended by com.thortech.xl.util.adapters.tcUtilPSTools


public class tcUtilPSTools
extends java.lang.Object

This is a wrapper class utilizing PSTools utility released by sysinternals.com. It based on executing a batch files remotely using psexec.exe provided by PSTools. It assumes this executable is in the system path. The paths and names of the associated batch files should be provided.


Constructor Summary
tcUtilPSTools()
          Creates a new tcUtilPSTools object.
tcUtilPSTools(java.lang.String admin, java.lang.String adminPwd, java.lang.String adminDomain, java.lang.String compName)
          Constructs tcUtilPSTools object with the following parameters

 

Method Summary
 java.lang.String addUserToFolder(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String sharePath, java.lang.String user, java.lang.String permissions)
          Adds a user to have access to the directory (Security tab under folder properties)
 java.lang.String createDirectory(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String newDir)
          Creates a directory on the target machine
 java.lang.String createShare(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String shareName, java.lang.String sharePath, boolean hidden)
          Creates a share on the target machine
 java.lang.String deleteDirectory(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String dir)
          Deletes a directory on the target machine
 java.lang.String deleteShare(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String shareName)
          Deletes a share on the target machine
static java.lang.String exec(java.lang.String command)
          Executes the specified string command in a separate process
 java.lang.String removeUserFromFolder(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String sharePath, java.lang.String user)
          Removes a user from having access to the directory (Security tab under folder properties)
 java.lang.String renameDirectory(java.lang.String batchPath, java.lang.String batchFileName, java.lang.String existingDirPath, java.lang.String newDirName)
          Re-names an existing directory on the target machine RENAME [drive:][path]filename1 filename2.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

tcUtilPSTools

public tcUtilPSTools()
Creates a new tcUtilPSTools object.

tcUtilPSTools

public tcUtilPSTools(java.lang.String admin,
                     java.lang.String adminPwd,
                     java.lang.String adminDomain,
                     java.lang.String compName)
Constructs tcUtilPSTools object with the following parameters
Parameters:
admin - Administrator login to use to access remote machine
adminPwd - Administrator password to use with the login to access remote machine
adminDomain - The domain under which the target computer is
compName - Target computer name

Method Detail

createDirectory

public java.lang.String createDirectory(java.lang.String batchPath,
                                        java.lang.String batchFileName,
                                        java.lang.String newDir)
Creates a directory on the target machine
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
newDir - The absolute path of the directory to be created
Returns:
The error code as a string

deleteDirectory

public java.lang.String deleteDirectory(java.lang.String batchPath,
                                        java.lang.String batchFileName,
                                        java.lang.String dir)
Deletes a directory on the target machine
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
dir - The absolute path of the directory to be deleted
Returns:
The error code as a string

renameDirectory

public java.lang.String renameDirectory(java.lang.String batchPath,
                                        java.lang.String batchFileName,
                                        java.lang.String existingDirPath,
                                        java.lang.String newDirName)
Re-names an existing directory on the target machine RENAME [drive:][path]filename1 filename2. or REN [drive:][path]filename1 filename2. Note that you cannot specify a new drive or path for your destination file.
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
existingDirPath - The absolute path of the directory to be deleted, ex: "c:\dirOld"
newDirName - The new directory name, ex: "dirNew"
Returns:
The error code as a string

createShare

public java.lang.String createShare(java.lang.String batchPath,
                                    java.lang.String batchFileName,
                                    java.lang.String shareName,
                                    java.lang.String sharePath,
                                    boolean hidden)
Creates a share on the target machine
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
shareName - Share name of the sharing directory
sharePath - Absolute path of the sharing directory
hidden - true is the share is hidden, false otherwise
Returns:
The error code as a string

deleteShare

public java.lang.String deleteShare(java.lang.String batchPath,
                                    java.lang.String batchFileName,
                                    java.lang.String shareName)
Deletes a share on the target machine
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
shareName - Share name (that is to be deleted) of the shared directory
Returns:
The error code as a string

addUserToFolder

public java.lang.String addUserToFolder(java.lang.String batchPath,
                                        java.lang.String batchFileName,
                                        java.lang.String sharePath,
                                        java.lang.String user,
                                        java.lang.String permissions)
Adds a user to have access to the directory (Security tab under folder properties)
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
sharePath - The path of the directory
user - The user to add to the folder,... format: DOMAIN\User, User
permissions - The permissions to the folder of the user added, (format: ":F", ":C", ... for Full Control, Change, ... permissions)
Returns:
The error code as a string

removeUserFromFolder

public java.lang.String removeUserFromFolder(java.lang.String batchPath,
                                             java.lang.String batchFileName,
                                             java.lang.String sharePath,
                                             java.lang.String user)
Removes a user from having access to the directory (Security tab under folder properties)
Parameters:
batchPath - The absolute path of the batch file(without the '\' at the end) on local machine that is to be copied to target machine and executed there.
batchFileName - The name of the batch File
sharePath - The path of the directory
user - The user to remove from the folder,... format: DOMAIN\User, User
Returns:
The error code as a string

exec

public static java.lang.String exec(java.lang.String command)
Executes the specified string command in a separate process
Parameters:
command - command to execute

Skip navigation links


Copyright © 2014, Oracle and/or its affiliates. All rights reserved.