How to get the name of the selected user in Active Directory.
Hi,
I have added an vbs script to the Active Directory GUI, to do some actions on a selected user.
When I right-click on a AD user, I choose my custom option, and a vbs script starts.
So far so good, but in the script i would like to know the account (logonname) for that user.
I can find many examples to do that with a script and a given parameter, but the parameter is in my case, the selected user in AD.
Who can help ?
Luc
You just need to take the arguments and echo out the samaccountname (or do something else with it) -
Set wshArgs=WScript.Arguments
Set adsUser=GetObject(wshArgs(0))
MsgBox adsUser.samaccountname
Similar Messages
-
How to get Primary Group details of a user from Active Directory
Hi ,
This is Viswanath. I want to know how can we retrieve the primary group of a user (Active Directory). I have searhed the entire forum but could not get the required information.
The reference link is which i have searched is : http://forum.java.sun.com/thread.jspa?threadID=581444
I got a sample .NET project where we can retrieve the primary group information :
refer to the link : http://dunnry.com/blog/DeterminingYourPrimaryGroupInActiveDirectoryUsingNET.aspx
you can download the sample project and build that in VS.NET 2003 and see the result. Please let me know if this kind of implementation is possible in java.
Kindly help me as i have to provide a solution to my client.
Regards,
Viswanath.
Edited by: sriganesh on Jun 22, 2008 10:36 AM
can anybody please share their thoughts on the aboveTo connect to the Active Directory you can do something like this:
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
public class AD
public static void main(String[] args)
Hashtable environment = new Hashtable();
//Just change your user here
String myUser = "myUser";
//Just change your user password here
String myPassword = "myUser";
//Just change your domain name here
String myDomain = "myDomain";
//Host name or IP
String myActiveDirectoryServer = "192.168.0.20";
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.PROVIDER_URL, "ldap://" + myActiveDirectoryServer + ":389");
environment.put(Context.SECURITY_AUTHENTICATION, "simple");
environment.put(Context.SECURITY_PRINCIPAL, "CN=" + myUser + ",CN=Users,DC=" + myDomain + ",DC=COM");
environment.put(Context.SECURITY_CREDENTIALS, myPassword);
try
DirContext context = new InitialDirContext(environment);
System.out.println("Exit!!");
catch (NamingException e)
e.printStackTrace();
Reddy Pathepuram
Inteligic Inc -
How to get domain name for the userId?
There is a generic way to get userID
System.getProperty( "user.name" ).
In case of windows it's a name you login in.
Is any way in Java to figure out domain name of that particular user by Java code?
IgorYou can dojava.net.InetAddress.getLocalHost().getHostName()to get the name of the computer. But this will not give you the "domain name of the user". In Windows, for example, when I sign on to my computer, that user name only means something to my computer. There's no "domain", in the Internet sense, involved.
-
How to get my Name in the From Field instead of email address?
For an Exchange Activesync account, how do you get your friendly "Name" to show in the From: field rather than email address ([email protected])?
I seem to be able to do this fro IMAP/POP accounts but not Exchange Activesync.
All the discussions I've found about gmail and Activesync seem to be centered on getting your messages to show a different return email address than your exchange account. I'm not looking for this, just to show the Name.
ThanksIf you add a contact ("Contacts app>> "+">> enter info) with that email address, it will appear in mail with whatever name you set in the email address' contact.
-
How to get a name of the current marker?
I have two director files with same identical marker names (2
language versions). How I can make a button that changes the
language (goes to the same marker of the other file). Something
like... go to "current marker name here" of movie
"language_2".ok, now the really cool method. You can get any marker name
whether it's
above the current frame or not.
mkrName = (the markerList)[(marker (0)).string]
will give you the marker above the current frame or the first
marker to the
left of the current frame if there is no marker above the
current frame.
Similarly,
mkrName = (the markerList)[(marker (1)).string]
will give you the first marker to the right of the current
frame whether
there is a marker above the current frame or not. You can see
how you can
get the name of any marker just by changing the parameter of
the marker ()
function.
If you're worried that the first example doesn't tell you
whether the marker
is above or behind the current frame a simple test will do.
if marker (0) = the frame then
-- this is true when the marker is on the current frame
end if
Craig Wollman
Word of Mouth Productions
phone 212 928 9581
fax 212 928 9582
159-00 Riverside Drive West #5H-70
NY, NY 10032
www.wordofmouthpros.com
"temes" <[email protected]> wrote in message
news:e4hate$ods$[email protected]..
>I have two director files with same identical marker
names (2 language
> versions). How I can make a button that changes the
language (goes to the
> same
> marker of the other file). Something like... go to
"current marker name
> here"
> of movie "language_2".
> -
How to get file name on the base of extension
hi
reply me
how to get the filename on the base of extension from the
current directory......
for example
i create file with the "igg" extension and save in the folder
where the exe file of director save....
i want when exe run then exe file read filename of the
define( "igg" ) extension with out path just name of the file with
igg extension
tel me how
regards
farhana khanHere's a solution that requires no xtras:
on GetFilesWithExtension(aFolderPath, aExtension)
-- INPUT: <aFolderPath> should be a valid string
folder path
-- <aExtension> may be a string file extension,
without the
-- dot. For example: "txt" or "igg"
-- OUTPUT: Returns an error symbol or a linear list of file
names
-- in the given folder. If an extension is given, only
-- files with the given extension will be listed. If not,
-- all files and folders will be listed.
vFileList = []
if not stringP(aFolderPath) then
return #stringPathExpected
end if
vIgnoreExtension = not stringP(aExtension)
vDelimiter = the itemDelimiter
the itemDelimiter = "."
n = 0
repeat while TRUE
n = n + 1
vFileName = getNthFileNameInFolder(aFolderPath, n)
if vFileName = "" then
exit repeat
end if
if vIgnoreExtension then
vFileList.append(vFileName)
else if the last item of vFileName = aExtension then
vFileList.append(vFileName)
end if
end repeat
the itemDelimiter = vDelimiter
return vFileList
end GetFilesWithExtension
You can also use
Buddy API's baFileList,
which allows you to do wildcard searching. -
How to get file name of the form attachment?
Hi,
is there anybody who is able to help me with the following problem???
I started my process from Workspace ES and as a first step I attached one locale file (IMG.JPG or IMG.TIF e.g.) as a form attachment. I used "Attachments" bookmark in the Workspace ES.
I need to get file name of attached file in the process!!!
I tried to use "getTaskAttachments" component to get file name of form attachment but without success. This component successfully obtained attached file an stored it in the variable (type list, subtype document) but didn't produce all file attribute informations such as basename or Content Type:
Is there some possibility to obtain file name (including file extension) by using "standard" tools and components of ALC?
Thanks for your suggestions.Hi LekomDev,
I faced the same situation some time back and this is what I know.
Based on the file type few of the attributes will or will not be populated. (This is what the official documentation says about Document attributes)
The file name that you are looking for would mostly be in 'name' attribute of Document object. The 'wsfilename' attribute is the atrribute which gets used to show the file name into Attachments tab of the workspace.
So, if you are just interested in knowing the filenames then 'name' attribute is the place that you are looking for.
But if you are trying to solve an issue in which Attachments against a Task isn't showing the filenames properly then you would need to copy the 'name' attribute value into 'wsfilename' attribute and then the Attachmetns against a Task would have the correct names.
Tip: Use the Record and Playback option of the workbench to inspect the Document variable and you would see all of the values for a Document variable at desired step in your orchestration.
hope this helps,
cheers,
Parth Pandya
Blog: http://livecyclekarma.wordpress.com -
ISR FORM how to get Employee Name based on Login User From R3
hi,,
I am working on ISR Adobe Forms.In the form I have to display the Employee Name,according to the portal logged in user.I have written a Function Module which fetches the Employee Name, based on Employee Code(PERNR) .I will be viewing the form in portal, so the current logged in user's PERNR should be passed to the BADI.How can I do this?
Regards,
Rheema Rahael.Hi Rheema,
Write the code, in the initialisation method of the BADi, to fetch the personnel number for the respective sy-uname from the communications infotype.
Hope this helps.
- anto.
Message was edited by:
Antony John Isacc -
Setting the logonHours attribute for a user in Active Directory
Hi Anyone,
I'm a brasilian guy and I need your help. How can I set the logonHours attribute on my Active Directory?
I have this code but it doesn't works good:
public void setLogonHours(boolean[] logonHoursBits){
int i;
int j;
int k;
int index21 = 0;
int index24 = 0;
byte[] byteLogonHour = new byte[21];
byte byte8Hours = 0;
for(i=0; i <= 6; i++){
for(j=1; j <= 3; j++){
for(k=7; k >= 0; k--){
if (i < 6){
if (logonHoursBits[i] == (boolean)(index24 == 0) ? true : false){
byte8Hours += (byte)Math.pow(2,k);
else{
if (logonHoursBits[0] == (boolean)(index24 == 0) ? true : false){
byte8Hours += (byte)Math.pow(2,k);
index24++;
byteLogonHour[index21] = byte8Hours;
index21++;
index24 = 0;
try{
String nome = "CN=Dryelle,OU=Pesquisa,DC=cifya,DC=com,DC=br";
ctx = new InitialLdapContext(env,null);
ModificationItem logonHours[] = new ModificationItem[1];
logonHours[0]= new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("logonHours",byteLogonHour));
ctx.modifyAttributes(name,logonHours);
System.out.println("Atributo logonHours alterado com sucesso.");
catch (NamingException e) {
System.err.println("Problema na altera??o " + e);
}the code set the attribute but wrong. Can anyone help-me? It's making me crazy.
Sorry about my poor english.
Tks.
Edited by: th_slopes on Aug 15, 2008 5:50 PMDirContext ctx = new InitialDirContext(pr);
BasicAttributes entry = new BasicAttributes(true);
String entryDN = "cn=CharbelHad,ou=test users,dc=test,dc=dev";
Attribute cn = new BasicAttribute("cn", "ChHad");
Attribute street = (new BasicAttribute("streetAddress", "Ach"));
Attribute loginPreW2k = (new BasicAttribute("sAMAccountName", "[email protected]"));
Attribute login = (new BasicAttribute("userPrincipalName", "[email protected]"));
Attribute sn = (new BasicAttribute("sn", "Chl"));
Attribute pwd = new BasicAttribute("unicodePwd", "\"Ch@341\"".getBytes("UTF-8"));
Attribute userAccountControl = new BasicAttribute("userAccountControl", "512");
Attribute oc = new BasicAttribute("objectClass");
oc.add("top");
oc.add("person");
oc.add("organizationalPerson");
oc.add("user");
// build the entry
entry.put(cn);
entry.put(street);
entry.put(sn);
entry.put(userAccountControl);
entry.put(pwd);
entry.put(login);
entry.put(loginPreW2k);
entry.put(oc);
ctx.createSubcontext(entryDN, entry); -
SQL Query to get All AD Groups and its users in Active Directory
Hi,
Is there any query to get all AD groups and its user in an instance of a SQL server?Check this blog.
http://www.mikefal.net/2011/04/18/monday-scripts-%E2%80%93-xp_logininfo/
It will give you more than what is required. If you dont want the extra information,then you can try this.. I took the query and removed the bits that you might not require.
declare @winlogins table
(acct_name sysname,
acct_type varchar(10),
act_priv varchar(10),
login_name sysname,
perm_path sysname)
declare @group sysname
declare recscan cursor for
select name from sys.server_principals
where type = 'G' and name not like 'NT%'
open recscan
fetch next from recscan into @group
while @@FETCH_STATUS = 0
begin
insert into @winlogins
exec xp_logininfo @group,'members'
fetch next from recscan into @group
end
close recscan
deallocate recscan
select
u.name,
u.type_desc,
wl.login_name,
wl.acct_type
from sys.server_principals u
inner join @winlogins wl on u.name = wl.perm_path
where u.type = 'G'
order by u.name,wl.login_name
Regards, Ashwin Menon My Blog - http:\\sqllearnings.com -
How to get Resource Name in the Repository Service when Publish evt trigger
Hi ,
I have created a repository service in which I have registered the
StatemanagementEvent.PUBLISH
My requirement is I need to know which resource rather resource name triggered this event.
This is the code which
public class ApprovProcs extends AbstractRepositoryService implements IReconfigurable, IResourceEventReceiver
private static final String TYPE = "ApprovProcs";
private Collection repositoryManagers;
public ApprovProcs()
super();
// Do not add code here. Add it to startUpImpl() instead
public String getServiceType()
return ApprovProcs.TYPE;
protected void startUpImpl(Collection repositoryManagers) throws ConfigurationException, StartupException
// implement this method as follows:
// - Verify configuration data
// - Get references to other needed (global) services
// - Check whether other repository services (this service depends on) are also assigned to the repository managers
// - Usually the service registers itself for certain events at all repository managers
this.repositoryManagers = repositoryManagers;
Iterator it = repositoryManagers.iterator();
while (it.hasNext())
try
addRepositoryAssignment( (IRepositoryManager) it.next());
catch (ServiceNotAvailableException e)
e.printStackTrace();
protected void shutDownImpl()
Iterator it = repositoryManagers.iterator();
while (it.hasNext())
try
removeRepositoryAssignment( (IRepositoryManager) it.next());
catch (WcmException e)
e.printStackTrace();
protected void addRepositoryAssignment(IRepositoryManager mgr) throws ServiceNotAvailableException
// Implement this method: Usually the service registers itself for certain events at the repository manager.
try
// capture all the respurce which are published
mgr.getEventBroker().register( this, new StatemanagementEvent( StatemanagementEvent.PUBLISH, null ));
catch(WcmException e)
protected void removeRepositoryAssignment(IRepositoryManager mgr) throws WcmException
// Implement this method: Usually the service must unregister itself as an event handler.
//mgr.getEventBroker().unregister(this, new ResourceEvent(ResourceEvent.CREATE_COLLECTION, null));
mgr.getEventBroker().unregister( this, new StatemanagementEvent( StatemanagementEvent.PUBLISH, null ));
public void reconfigure(IConfiguration config) throws ConfigurationException
this.stateHandler.preReconfigure();
// check the new configuration data
try {
catch (ConfigurationException ex) {
this.stateHandler.postReconfigure(ex);
throw ex;
this.config = config;
this.stateHandler.postReconfigure();
public void received(IEvent event)
System.err.println( "----rid --42354543--- " );
IResource rsrPublished = (IResource)event.getParameter();
if( rsrPublished != null )
System.err.println( "----rid --42354543--- rsrPublished.getDescription() --- " + rsrPublished.getDescription() );
else
System.err.println( "Resource Does not exist -----" ) ;
In the log file I am getting Null Pointer Exception
Can any one please help me in this as where I am going wrong
thanks
pkHi Romano & Detlev ,
Thanks for the reply .
This is what I was looking
Detlev:
About the NPE ... in the above code I am not getting that.
Thats my mistake
Earlier I tried with
IResource rsrPublished = (IResource)event.getParameter();
String rid = rsrPublished.getRID().toString();
In the second line of code I was getting the NPE
after that I used to if condition to debug it
Sorry for the confusion...
One more thing
which is the event triggered for approval or how to capture the Approval Event when a content is approved by the Approver
thanks
pk -
How to get CLASS name for the generic item?
Hi,
I wrote following method to create a service instance.
public static <IType> IType GetServiceInstance()
IType type=null;
try
InitialContext ic=new InitialContext();
//ERROR: type= ic.lookup(IType.class.getName());
catch(Exception ex)
//do handle
return type;
}please see the //Error: here its giving error, also i m not getting "class" variable in IDE!!!
i want use like this;
IUserService userService=ServiceFactory.GetServiceInstance<IUserService>();so how can i do this?
Edited by: Manikandan.Java on Oct 31, 2007 3:02 AMI don't know if I understand your question, but you cannot find the class name because it is in run time just an object. You can, however, check if it is an instanceof.
if (genericType instanceof MyType) {
doMyThing();
} -
How to get host name in the workflow?
Hi,
I've a requirement where I need to get CQ Inbox url (http://<hostname>:<port>/inbox) in my custom workflow process. I thought of configuring url to some node and retriving from there.. but It's not the good approach as host name will be different for differnt CQ environments. So what is the best way of getting inbox url?
Env: CQ 5.6
Thanks
SivaYep Justin, If the configuration is wrong, any link generated would also be wrong.. I mean, default configuration will be some thing like..
I mean, I can change those configurations as per my instance host name, right?
Example: my instance's host url is: mytest:1501
So I would like to update the same in configurations .. -
How to get reference name in the class
i have a doubt in java.
class x
public String toString()
// code here i want
class y
p s v main(.....)
x servlets=new x();
x jsp=new x();
s.o.p(servlets);
s.o.p(jsp);
the result i want is :
hai servlets
hai jsp
what code to be in toString().You can't get hold of the variable name at runtime. If you want that output, you'll need to create it like this:
x servlets=new x("servlets");so that the x.toString() can know which string to print out.
Message was edited by:
johannef -
How to get functionID/Name of the current page
Hi guys,
I have two EBS standard forms "Supplier Entry" and "Supplier View Only" defined as two separate functions in the menu. Depending on which function was launched by the user I have to do some extension.
I found that following code can be used to know whether function is available in the menu or not. But the problem occurs in situation where both functions are available to the user and since the logic fail.
FunctionSecurity funcSecurity = pageContext.getFunctionSecurity();
boolean isFunc1 = funcSecurity.testFunction(funcSecurity.getFunction("YOUR_FUNCTION_SHORT_NAME1"));
I need to know specifically which function was used to launch the form.
On the following post https://forums.oracle.com/message/10468620#10468620 Parag tell something like this
( "IMC_NG_ORG_CONTACTS".equals(pageContext.getParameter("ImcLandingFunction"))
but I don't know what "ImcLandingFunction" equates to in my scenario. I don't see AOL functions passing any parameters to forms.
or is there any other method to know?
Can anyone help?did you try these ones ? :
pageContext.getFormSubmitName();
pageContext.getFunctionId();
Maybe you are looking for
-
How do I reformat a macbook air to original factory settings?
I am trying to reformat my macbook air to original factory settings. I don't need to use any of the files currently on the HD, so just a clean wipe is all I need. Can anyone help?
-
Invalid Security Code during application download in Appstore
I want to download watsapp messenger to my iPhone 3GS but when i proceed to buy app option in App store it shows that your payment method is declined. Again when i update my payment information it shows invalid security code while all info is correct
-
IDVD 08 crashes right before burning
I installed this overtop of iDVD5, and ever since, I haven't been able to make a DVD. As it is encoding, the program abruptly turns off, no error messages, nothing. I've read some other threads about this, and I have plenty of hard drive space, I tri
-
How can I remotely control a WindowsXP PC?
Hello, I just got a MacMini (my first Mac ever) last week and I've got a friend with XP on her PC. She's VERY new to computers in general and sometimes could use some assistance getting around. I'd like to be able to connect with my new Mac. Does any
-
Tiny crack in Macbook Pro 13 inch screen?
There's this tiny v-shaped crack in my macbook pro 13 inch screen. Inside the v shaped crack it's cloudy and i can't see the screen clearly through the v shape. The crack itself is rainbow colored and at first I thought it was water or something. But