Group: microsoft.public.scripting.vbscript
From: "Al Dunbar"
Date: Monday, October 22, 2007 6:55 PM
Subject: Re: objComputer.UserName value is empty


"Gert Albertse" wrote in message
news:1193043478.136504.14550@z24g2000prh.googlegroups.com...
> When running this script the objComputer.UserName value is empty

Do you have a question, or are you just making a comment?

/Al

> Option Explicit
> Dim objWMIService, objComputer, colComputer, strComputer
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" _
> & strComputer & "\root\cimv2")
> Set colComputer = objWMIService.ExecQuery _
> ("Select * from Win32_ComputerSystem")
>
> For Each objComputer in colComputer
> Wscript.Echo objComputer.UserName & " is logged on"
> Next
>