@MinDoc(copyright="Copyright 2005, 2007, 2014 A. Weinert", author="Albrecht Weinert", version="V.32", lastModified="22.03.2021", lastModifiedBy="A. Weinert", usage="static import + embedded OSexec to run (windows) processes", purpose="helper for administrative tasks and applications (on Windows at present)") public final class AdmHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AdmHelper.OSexec
Handling / wrapping a process.
|
Modifier and Type | Field and Description |
---|---|
static String |
computername
The (local) computer's name.
|
Modifier and Type | Method and Description |
---|---|
static int |
accountAct(String user,
boolean active)
Lock or activate an (user) account (Windows 2K, XP, 2K3, 2K8 only).
|
static int |
chgPWord(String user,
String pw)
Change a user accounts password (Windows 2K, XP, 2K3, 2K8 only).
|
static int |
connect(String ger,
String frg,
String user,
String pw)
Connect a (network) device (Windows 2K, XP, 2K3, 2K8 only).
|
static int |
disconnect(String ger)
Disconnect a (network) device (Windows 2K, XP, 2K3, 2K8 only).
|
static int |
execProg(String[] args,
int maxWait)
Execute a programme / process.
|
static String |
getComputername()
The (local) computer's name.
|
static int |
isPCon(String computer,
Socket testSock,
int port,
int connectTimeOut,
StringBuilder statusInfo)
Is a PC / a computer on.
|
static int |
logOut()
Log out the (local) user (Windows 2K, XP, 2K3, 2K8 only).
|
static String |
pwCrypt(int baseKey,
String user,
String pw)
Password encryption (symmetric).
|
public static final String computername
getComputername()
public static int chgPWord(String user, String pw)
user
- the user account's namepw
- the user's passwordpublic static int accountAct(String user, boolean active)
user
- the user account's nameactive
- true: activate; false: lock out / disablepublic static int logOut()
public static int connect(String ger, String frg, String user, String pw)
ger
- the device to connect; e.g. "X:"frg
- published directory or its parent (base) directory
e.g. "\\\\193.175.115.15\\fb3stud\\uhu"user
- the user's name; e.g. "FB3-MEVA\\vvv"pw
- the user's passwordpublic static int disconnect(String ger)
ger
- the device to disconnect; e.g. "X:"public static int execProg(String[] args, int maxWait)
args
- [0] : the programme; [1...] parameters to it (one by one)maxWait
- <= 0: indefinite waiting; >0: max. waiting time for
the started process's return or exitAppBase.start(de.frame4j.util.App, String[])
public static final String getComputername()
public static String pwCrypt(int baseKey, String user, String pw)
baseKey
's and user
's value.pw
will be returned as is.
String pwPlain = "notQuitePublic";
String pwEncod = pwCrypt(bK, user, pwPlain);
String pwDecod = pwCrypt(bK, user, pwEncod);
will return the original value.public static int isPCon(String computer, Socket testSock, int port, int connectTimeOut, StringBuilder statusInfo)
computer
- the computer's name, not null or emptytestSock
- if not null it will be used to (test) connectport
- port for test connecting (default 7)connectTimeOut
- maximum waiting time for the test connection
(400..10000; default 999)statusInfo
- if not null, a (human) readable status text will
be appended to here