Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How reliable/secure are getenv('User') & WScript.Network
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00953302
Message ID:
00954695
Vues:
15
I think we're on the right track here. This definitely helps me distinguish between a local user and a domain user! That's a huge start!!

I'll have to play with this a bit more to see if it holds consistant in different scenarios but the first thing I tried seemed to work slick!

Rodd

>Rodd, Here you have some code to test (it will require VFP 7+, I think):
>
>
>try
>	loWBEMLocator	= createObject("wbemScripting.SwbemLocator")
>	loWMIService	= loWBEMLocator.ConnectServer()
>catch
>	loWMIService	= null
>endtry
>
>if not Isnull(loWMIService)
>	loCSs			= loWMIService.ExecQuery('Select * from Win32_LoggedOnUser')
>	for each loCS in loCSs
>		try
>			loUser	= Getobject('Winmgmts:' + Strtran(loCS.Antecedent, '//', '/'))
>			? 'Domain     : ', loUser.Domain
>			? 'Local?     : ', loUser.LocalAccount
>			? 'Name       : ', loUser.Name
>		catch
>			? 'Error getting the User data'
>		endtry
>	endfor
>endif
>
>
>I this somewhat answers you question (Although I can not test for sure, I am only logged into my domain), the only problem is getting rid of the System accounts (Like SYSTEM, LOCAL SERVICE, NETWORK SERVICE, etc)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform