Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How reliable/secure are getenv('User') & WScript.Network
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00953302
Message ID:
00954619
Views:
13
Hello Hugo,

Thanks for this information. Do you know where WMI pulls the user information from? Is it pulling the username & domain from the same environment variables that getenv() & WScript.Network do?

Thanks for your help!

>Just to give a 3rd alternative, you can use WMI:
>
>
>? getCurrentUser()
>
>
>function getCurrentUser()
>local loWMIService, loWBEMLocator, lcDomain, loCSs, loCS
>
>lcUser		= 'N/A'
>try
>	loWBEMLocator	= createObject("wbemScripting.SwbemLocator")
>	loWMIService	= loWBEMLocator.ConnectServer()
>catch
>	loWMIService	= null
>endtry
>
>if not Isnull(loWMIService)
>	loCSs			= loWMIService.ExecQuery('Select UserName from Win32_ComputerSystem')
>	for each loCS in loCSs
>		lcUser		= loCS.UserName
>		exit
>	endfor
>endif
>return lcUser
>
>
>
>
>lcUser will have the "domain\username" format, from where you can parse both
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform