Some remote systems are not available to be connected directly within OIM (maybe legacy systems, proprietary systems etc.) For such cases, you may be able to execute scripts on the native systems. These scripts come handy to create, say for example, a home directory in a remote system. So, here is the code you may use to create a connector and execute the script. Modify as needed.
============================================
ADCreateHomeDir.java
============================================
public class ADCreateHomeDir {
public String callScript(String script, String username) {
int exitVal = -1;
try {
Runtime rt = Runtime.getRuntime();
String execute = "cscript " + script + " " + username;
Process proc = rt.exec(execute);
InputStream stderr = proc.getErrorStream();
InputStream stdin = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(stderr);
InputStreamReader isr2 = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
BufferedReader br2 = new BufferedReader(isr2);
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
while ((line = br2.readLine()) != null) {
System.out.println(line);
}
exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
} catch (Throwable t) {
t.printStackTrace();
}
return String.valueOf(exitVal);
}
}
If you need help to develop a VBScript, you may use any commerically available tool such as http://www.wintask.com . This even allows to create a script to send keystrokes and mouse events to a gui app. You may use this or any VBScript to be called by remote manager with a simple java connector and pass parameters.
courtesy:Mark Earnest
Monday, July 7, 2008
Executing VBScripts within OIM
Posted by Rajnish Bhatia at 5:03 PM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment