Re: Win32_ComputerSystem



I am pretty sure that you will need to be an administrator to see that
information about other logged in user processes. The script below worked
for me when I connected to the remote server as an administrator. A good
test is to use Task Manager to see if your user account has rights to see
the owner of the other processes that are owned by different users.

--
Scott McNairy
Microsoft MVP - Windows Server Management Infrastructure


"mrgadgetnz" <mrgadgetnz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C7712535-1D35-48DC-9262-C48BAFD8C227@xxxxxxxxxxxxxxxx
> Scott,
>
> Sorry to hijack the thread, but I've tried your code, and also the code in
> the scripting library for finding the owner of a process. This is great,
> only it doesn't return an owner for others' processes. I get the owner
> details back on processes owned by me, but just blank back on others'
> processors...
>
> Ideas?
>
> Thanks,
> Ben.
>
> "Scott McNairy (MVP)" wrote:
>
>> That property uses the GetUserName api documented here
>> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getusername.asp)
>> as you can see it has a couple of considerations that make it not so
>> reliable in the way you are seeing in determining who is currently logged
>> into the system. I think that the below script may give you better
>> results
>> as others have had success with it.
>>
>> set svc = getObject("winmgmts:root\cimv2")
>> set objEnum = svc.execQuery("select __relpath from win32_process where
>> caption = 'explorer.exe'")
>> for each obj in objEnum
>> set outParams = obj.ExecMethod_("GetOwner")
>> wscript.echo outParams.Domain & "\" & outParams.User
>> next
>>
>> --
>> Scott McNairy
>> Microsoft MVP - Windows Server Management Infrastructure
>>
>>
>> "Bart Perrier" <bart_perrier@xxxxxxxxxxx> wrote in message
>> news:%232iCraPfFHA.1248@xxxxxxxxxxxxxxxxxxxxxxx
>> >I appreciate both replies. I am considering the last logged in user as
>> > mentioned by Ato as a "best guess" if my Win32_ComputerSystem query is
>> > NULL.
>> > The more I think about it, the better it sounds...given the other
>> > result
>> > failed.
>> >
>> > I'm searching for another Class but haven't seen one for logged in
>> > user.
>> >
>> > Thanks for both ideas.
>> >
>> > Bart
>> >
>> >
>> > "Mike Long" <mlong35@xxxxxxxxx> wrote in message
>> > news:1120078092.298399.260530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> >> An alternate method I use is environment strings.
>> >>
>> >> Set WshShell = WScript.CreateObject("Wscript.Shell")
>> >> Username = WshShell.ExpandEnvironmentStrings("%USERNAME%")
>> >>
>> >>
>> >> Mike
>> >> -Knowing it doesn't really answer the question, but trying to help
>> >> anyway
>> >>
>> >
>> >
>>
>>
>>


.



Relevant Pages

  • Re: Win32_ComputerSystem
    ... it does appear that you do indeed need admin priviledges. ... way to raise the priviledges of a script? ... "Scott McNairy " wrote: ... > the owner of the other processes that are owned by different users. ...
    (microsoft.public.scripting.vbscript)
  • Re: printuientry
    ... you could put it into a logon script. ... The error did not occur as a network administrator. ... I've tried several variations on the command syntax and can not get it ... >> printer is already defined on a "local port", ...
    (microsoft.public.win2000.printing)
  • Re: Domain Users to have Local Admin rights
    ... make sure that your script works. ... this computer as local administrator and insert USB drive. ... startup script (e.g. OU policy or Default Domain Group Policy). ... Now close this windows and click on ...
    (microsoft.public.windows.server.security)
  • RE: Script or Other Method to Reboot
    ... > We need different privileges when using Shutdown command and shutdown the ... > that only administrator will use command to shutdown the computers. ... > we may need to compile the script. ...
    (microsoft.public.windowsxp.configuration_manage)
  • Re: Cmd Line adding users, Im sure it has been asked but....
    ... I can run it as the domain admin. ... Why not just use the builtin Administrator account as the local ... Just run a script that sets the builtin administrator account name to ...
    (microsoft.public.win2000.cmdprompt.admin)