Avatar of Math Tec
Math TecFlag for United States of America

asked on 

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

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
Windows OSWindows Server 2008Windows Server 2003

Avatar of undefined
Last Comment
Math Tec
Avatar of yo_bee
yo_bee
Flag of United States of America image

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
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
ASKER CERTIFIED SOLUTION
Avatar of yo_bee
yo_bee
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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?
Avatar of yo_bee
yo_bee
Flag of United States of America image

No.
When you create the task make sure it points to a Network share.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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?
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

Vbs is a file that is executable. Not sure why you need to crate an exe.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

I will reply tomorrow. Sorry i cannot get to it now
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

Hello,

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

Regards
Image.jpg
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

Are you able to confirm if the Task created in GPO pushed to the machine?
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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%

User generated image
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

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
Avatar of yo_bee
yo_bee
Flag of United States of America image

Can you take a screenshot of the options to select
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

Avatar of yo_bee
yo_bee
Flag of United States of America image

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


User generated image
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

I do not have that option. I have only two options as in attached
11.jpg
Avatar of yo_bee
yo_bee
Flag of United States of America image

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.
Avatar of Math Tec
Math Tec
Flag of United States of America image

ASKER

Yes, and  it is a domain controller
12.jpg
Windows Server 2003
Windows Server 2003

Windows Server 2003 was based on Windows XP and was released in four editions: Web, Standard, Enterprise and Datacenter. It also had derivative versions for clusters, storage and Microsoft’s Small Business Server. Important upgrades included integrating Internet Information Services (IIS), improvements to Active Directory (AD) and Group Policy (GP), and the migration to Automated System Recovery (ASR).

129K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo