Jump to content

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


Recommended Posts

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
Link to comment
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 ...
Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...