We help IT Professionals succeed at work.

Show last and first name of user when login to the domain

172 Views
Last Modified: 2019-01-02
Hi,

I have windows server 2008R2. I have a question is their possibility to connect login name with user information (First and last name). For example. if the first name of a user is Edward and the last name is Joy. So, when computer login it will appear a message on the screen
Welcome Joy, Edward

Thanks
Comment
Watch Question

yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Yes.

Create a delayed task at logon to run a vbs

Here is a link to a simple vbs that needs some minor tweaking

https://community.spiceworks.com/scripts/show/425-get-the-current-logged-on-user-s-first-last-name

Here is the tweaked version
Set objSysInfo = CreateObject("ADSystemInfo")
Set objCurrentUser = GetObject("LDAP://" & objSysInfo.UserName)
Msgbox (objCurrentUser.givenName  & " " &  objcurrentuser.lastname

Author

Commented:
Hello,

Thanks. Please, can you guide me to build delayed task at logon to run a vbs? You mean I need to do that and apply it on OU at the server?

Thanks
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
If your environment  setup with Active Directory?  You can use Group Policy Preferences.

Here is a step by step to setup a GPP | Scheduled Task.
Within the steps there is an option to delay the number of seconds before running.

Note you will need to have the VBS accessible for all users on the network.
Director of Information Technology
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi,

Thank you so much.
what do you mean by "Note you will need to have the VBS accessible for all users on the network"

Regards
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
If you create a task pointing to the c:\ drive and the vbs is not there then nothing will run.  

If this is for one computer do not even worry about that comment.

Author

Commented:
Thank You.

I will use GPO to do that. You mean I have to add the vbs to all computers in the domain or I just need it in the server?
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
No.
When you create the task make sure it points to a Network share.

Author

Commented:
Thank you so much.
This means I will give permission for all users in the domain to enter to this folder. Correct. What if one user deletes this vbs? How can I prevent that?
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
I would give domain admin full rights and domain users read and execute right. Remove delete rights for all domain user.

For anyone to delete you really need to know how to navigate the shares.

Author

Commented:
I generated .exe file using the above code, then I added this code to a share folder (all user have the permission to enter to this folder), then I created task with action create and in the start field I pointed to the shared folder and I made it run as administrator and in the schedule setting I made it run at login.

It is still not working. Please, what should I do?

Thank you so much
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Vbs is a file that is executable. Not sure why you need to crate an exe.

Author

Commented:
I added the code you send to .txt file then I changed the extension to vbs. But it is still not working. Can you please help me? any suggestion will be appreciate
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
I will reply tomorrow. Sorry i cannot get to it now

Author

Commented:
Hello,

I tried to execute the code that you send directly but I got this error
( I attached the error)

Regards
Image.jpg
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
I see you have D:\username\vbs.vbs.


Does this exist on the machine you are running it on. Most likely not and this is what I was referring to when I said you need to make sure it's on a share that all users have access to.

Author

Commented:
Hello,

Thank you so much for your reply. Please, this folder in the server and I made it share for all users. I attached the task setting.

Kind Regards
Task-Setting.pdf
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Your run command looks incorrect.

It should look like this

\\10.20.30.3\username\vbs.vbs

I would try navigating via windows or file explorer to the unc path and see you can run your vbs. If that works then  modify the task with the proper unc path.
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Also if you have the full path in the run field you do not need to populate the start in field.

If you use the start in field use the full unc path without the vbs.vbs and just put vbs.vbs in the run field.

Author

Commented:
Thank you so much.

This is the code that you send. and I attached the task but it is still not working
Set objSysInfo = CreateObject("ADSystemInfo")
Set objCurrentUser = GetObject("LDAP://" & objSysInfo.UserName)
Msgbox (objCurrentUser.givenName  & " " &  objcurrentuser.lastname)
5.jpg
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Have you tried to just run the vbs by double clicking it removing the task completely out of the mix as I suggested in the prior reply.

I do this method to validate the script then I will schedule it to my preference.

Author

Commented:
Thank you. When I run the code from a computer within active directory using

\\10.20.20.3\username\vbs.vbs

I got the login information for the user. But it is not working using GPO. I mean when I use run inside the windows and use above path it is working but when I logged off or restart computer the name does not show on welcome screen
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Are you able to confirm if the Task created in GPO pushed to the machine?

Author

Commented:
Hi,

I attached the image of the GPO. But when I logged off or restart the computer the name does not show on the welcome screen. The Policy name in the image is (UserName)

Thanks
7.jpg
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Another thing I noticed is that you are creating a Windows XP task.  You should use the Vista or Newer method.

When you create the task when running the task you want to use %logondomain%\%LogonUser%

Task1.png

Author

Commented:
Hello,

This is the task that is available in windows server 2008R2. Also, the type of action should be created Correct?

Any advice will be appreciated
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
The trigger tab is the schedule event time. For you it will be logon. The Action tab if where you enter your path and vbs.

I tested on my system and it worked as aspected.

Author

Commented:
For me, the schedule is log in and The Action tab where I enter my path and vbs. I did exactly that but it is not working
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Are you creating this  on Windows 2008 server?
You should have four options to select from

You want to delete the task you created and new one using the Schedule Task (Vista or Newer). From there you follow the tabs I outlined in a prior comment.

Author

Commented:
Yes, I am creating this on windows server 2008R2. I deleted the old task. But I do not know what you mean (using the Schedule Task (Vista or Newer). This option is not available in windows server 2008R2. How can I do that? If I created a task from the task scheduler how I can link this to GPO. I have to create task inside GPO
9.jpg
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Can you take a screenshot of the options to select

Author

Commented:
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
Here is the step I am referring to.  Your screenshots are all after the initial step.


Task2.png

Author

Commented:
I do not have that option. I have only two options as in attached
11.jpg
yo_beeDirector of Information Technology
CERTIFIED EXPERT

Commented:
You sure you are on a Windows 2008 R2 Server?
Is this server that you are creating the GPO on a Domain Controller or Member server?


Its not normal to not have this option in GPMC.

Author

Commented:
Yes, and  it is a domain controller
12.jpg

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.