CMAK Profile - Get username for script
I have created a CMAK profile for Windows 7 for an SSTP connection to distribute to users. I have also specified a Post-Connect action with a VBScript that prompts the user for their username and group and then maps the home folder to a drive letter. It works well, but it would be better if somehow I could get the username from the Connection Manager window which the user enters before hitting Connect. If I could input this as a variable in the script, the user would not need to enter the username again. Is there a way to get access to a variable that holds the value of the username? Thanks.
September 8th, 2011 5:00pm

Hello, Thank you for your question. I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience. Thank you for your understanding and support. Regards,Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2011 7:18am

Can you utilize environment class? There some environment variables post-logon like username, userdomain etc you could utilize. http://msdn.microsoft.com/en-us/library/system.environment_properties.aspx Let me know if you are looking for something else.Ketan Thakkar | Microsoft Online Community Support
September 14th, 2011 12:28pm

Thanks for taking the time to help with my problem. What I have already tried with environment variables seems to return the username, but not the correct one. Here is a sample code: Option Explicit Dim objNetwork, strUsername Set objNetwork = WScript.CreateObject("WScript.Network") strUserName = objNetwork.UserName WScript.Echo "The username is " & strUsername If I put this as a post-connect script I get the username of the currently interactively logged on user, not the username that has been entered in the Connection Manager window and which is actually being used for establishing the VPN connection. These would have been the same if the user has logged on on a domain-joined workstation but not if using a personal computer. Is there any way to get that value from the Connection Manager?
Free Windows Admin Tool Kit Click here and download it now
September 14th, 2011 1:41pm

Hi, I know this is not exactly what you are looking for but, ras tracing will contain that username if that helps. You can fetch the username from that trace file. I'm still looking for a way for you to be able to do it through api and I'll get back if I have something.Ketan Thakkar | Microsoft Online Community Support
September 15th, 2011 4:01pm

Hi, Can you send me the script that you are using? If so, send it to blrforum-at-microsoft-com (replace '-')Ketan Thakkar | Microsoft Online Community Support
Free Windows Admin Tool Kit Click here and download it now
September 19th, 2011 5:47pm

Hi, There are some WMI classes for session/user/process can help you achieve what you are looking for. However, we will need other groups to be involved into this in order to find out and some more research that doesn't fit for a forum query. Looking at the depth involved, we suggest you get a Phone call support case.Ketan Thakkar | Microsoft Online Community Support
October 5th, 2011 5:27am

Hi. Obviously it is not as trivial as it seemed. It would be nice if I could achieve it but it is not absolutely necessary. Since we would like to get started already with the VPN, I'll go without this for now and will keep this in mind for future considerations. Ketan and Arthur, thank you very much for your time, I really appreciate your cooperation. Maybe some day there will be an easier way of achieving this. :) Have a great day!
Free Windows Admin Tool Kit Click here and download it now
October 5th, 2011 5:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics