Sign in to follow this  
Followers 0
yejier

[help]for...in....next

5 posts in this topic

#1 ·  Posted (edited)

sorry,I'm poor in English,I have a trouble with "objget" and "for...in...next".

' VBScript。

Set LoginProfiles = GetObject("winmgmts:").InstancesOf ("Win32_NetworkLoginProfile")

for each Profile in LoginProfiles

WScript.Echo Profile.Name

WScript.Echo Profile.LastLogon

next

'au3.

$loginprofiles=ObjGet("winmgmts:Win32_NetworkLoginProfile")

;MsgBox(0,"",$loginprofiles)

For $profile In $loginprofiles

;MsgBox(0,"",$loginprofiles)

$text=String($profile.Name)

MsgBox(0,"", $text)

;MsgBox(0,"", $profile.LastLogon)

;MsgBox(0,"",objname($loginprofiles))

Next

but, why $profile.Name have no value?

Edited by yejier

Share this post


Link to post
Share on other sites



sorry,I'm poor in English,I have a trouble with "objget" and "for...in...next".

'au3.

$loginprofiles=ObjGet("winmgmts:Win32_NetworkLoginProfile")

;MsgBox(0,"",$loginprofiles)

For $profile In $loginprofiles

;MsgBox(0,"",$loginprofiles)

$text=String($profile.Name)

MsgBox(0,"", $text)

;MsgBox(0,"", $profile.LastLogon)

;MsgBox(0,"",objname($loginprofiles))

Next

but, why $profile.Name have no value?

On my PC, ubound($loginprofiles) reports zero entries - your call to ObjGet is not returning anything. Take a look at a post by resnullis in this thread. It may help ...

Share this post


Link to post
Share on other sites

thanks

Share this post


Link to post
Share on other sites

if you use objname($loginprofiles) before for....in....next will return value

but between in for...in..next objname($loginprofiles) have no value

Share this post


Link to post
Share on other sites

$strComputer = "localhost"

$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

$colItems = $objWMIService.ExecQuery("Select * from Win32_NetworkLoginProfile")

For $objItem in $colItems

MsgBox(0, 0, $objItem.Name)

MsgBox(0, 0, $objItem.LastLogon)

Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0