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:
00954895
Views:
12
Rodd,

Winmgmts: is a "Moniker" used to connect to WMI from scripting languges, for example, instead of this two lines:
loWBEMLocator	= createObject("wbemScripting.SwbemLocator")
loWMIService	= loWBEMLocator.ConnectServer()
I could've written:
loWMIService	= GetObject("Winmgmts:")
But, there were some problems in VFP 6 with this line, so when I post here, if I remember, I change this line for the previous two lines. The Winmgmts: moniker can be more complex than that, you can specify a security setting and a path to a WMI object, and that is exactly what the second GetObject does, for the class Win32_LoggedOnUser is an association class that has two "objects", called Antecedent and Precedent, I said "objects" but in realty they are not objects but just the paths to the objects that are part of the association as simple strings, thus, I can use GetObject to get them. If you see the value of them, for example Antecedent, you see something like:

\\.\root\cimv2:Win32_Account.Domain="YourDomain",Name="AccountName" (Interestingly enough, I just found that apparently you do not need the strtran I was using), so this is the path to the Win32_Account object, that you can get with the GetObject function, you only need to add to this string the Winmgmts moniker.

Well, not sure if my explanation is clear

By the way, in the debugger you should be able to see loCS.Antecedent and loCS.Precedent (loCS variable was from a previous example, I forgot to change the name) as simple strings, but nor intellisense not the debugger will be able to get them, you need to type in the watch window
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform