Recommended Posts

Hi guys,

I'm wanting to use, the Sysinernals App BGinfo, to display some info on the desktop (who'd of thunk it!)

One of the thinks i want to to display, is the name of the currently logged on user. Ive found this peice of WMI, but Its not working in BGinfo, any ideas?

SELECT FullName FROM Win32_NetworkLoginProfile WHERE LastLogon=(select max(LastLogon) FROM Win32_NetworkLoginProfile)

It's most likely something really simple!

Link to comment
https://www.neowin.net/forum/topic/651872-wmi-query/
Share on other sites

And the builtin UserName is not working?

post-14624-1217264389.jpg

why do you think you need to do a wmi query, when it has a builtin username you just click add on.

edit: Ah -- you want to pull the "fullname" just the account name. I'll take a look see.

edit2: Ok I think I found the thread found your info from.. Why not just use the vbs script the guy posted

http://forum.sysinternals.com/forum_posts....D=6669&PN=1

I tested this -- and works on my machine great.

I took the time to flesh this out into a proper script.

' ======================================
On Error Resume Next
Dim colWMI, objItem, colQuery, strUserID
Set colWMI = GetObject("WinMgmts:root/cimv2")
Set colQuery = colWMI.ExecQuery("Select UserName FROM Win32_ComputerSystem")

For Each objItem In colQuery
	strUserID = UCase(objItem.UserName)
Next

Set colQuery = colWMI.ExecQuery("Select * FROM Win32_NetworkLoginProfile")

For Each objItem In colQuery
	If UCase(objItem.Name) = strUserID Then
		WScript.Echo objItem.Fullname
	End If
Next
' ======================================

I probably could have made it smaller, but it works.  For purposes of BGInfo, you'll need to replace the one "wscript.echo" with just "echo".

This command doesn't access ADSI, instead getting everything from WMI.

--Magic--

Just save in a filename.vbs file -- add in bginfo.. Just change the one line WScript.Echo to Echo and works perfect.

Edited by BudMan
Link to comment
https://www.neowin.net/forum/topic/651872-wmi-query/#findComment-589589679
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Lmao. Cries about not playing those games not installed and yet don't ever want to touch them.
    • If I want to merge folder trees that have a similar structure, Beyond Compare is always my first choice. It's not free but it's awesome. If I want to just scan a whole drive/folder and find duplicates that are taking up space, I like Czkawka.
    • Claude Code gets throttled as Anthropic rolls out fresh usage caps by David Uzondu Claude Code, the AI-in-terminal utility developed by Anthropic and launched back in February, is getting updated usage limits following weeks of user complaints about being abruptly cut off. Many developers on the "$200/month Max plan" found their access blocked after just a few requests, with no explanation from the company. In a recent thread posted to X, the AI lab explained that it has seen "unprecedented demand since launch," pointing to some of its heaviest users who were running the tool continuously in the background 24/7, with one person reportedly consuming tens of thousands of dollars in model usage on a single $200 subscription. Anthropic also claimed that some users were violating its usage policy by sharing and reselling accounts, which impacts system capacity for everyone. These factors all led the company to announce new weekly limits that will be added on top of the existing five-hour caps, effective August 28. Max plan subscribers will have the option to buy additional usage at standard API rates if they hit their cap. Here's what the new weekly limits look like: Pro Plan ($20/month): An estimated 40 to 80 hours of usage with the Sonnet 4 model. Max Plan ($100/month): An estimated 140 to 280 hours with Sonnet 4 and 15 to 35 hours with the top-tier Opus 4 model. Max Plan ($200/month): An estimated 240 to 480 hours with Sonnet 4 and 24 to 40 hours with Opus 4. Per TechCrunch, the company provided these hour-based estimates, noting that the actual numbers may vary based on the size of a project's codebase. What's interesting is how this new structure compares to the old marketing. Anthropic previously advertised its $200 Max plan as offering 20 times more usage than the Pro plan. Based on these new hourly estimates, that multiple is now closer to six. It is possible the 20x figure still applies when measured in tokens or raw compute, but, according to TechCrunch, the company has not clarified that point.
    • I don't give a rat's f### what Trumpette, the Putin puppet likes!
  • Recent Achievements

    • First Post
      Gladiattore earned a badge
      First Post
    • Reacting Well
      Gladiattore earned a badge
      Reacting Well
    • Week One Done
      NeoWeen earned a badge
      Week One Done
    • One Month Later
      BA the Curmudgeon earned a badge
      One Month Later
    • First Post
      Doreen768 earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      637
    2. 2
      ATLien_0
      260
    3. 3
      Xenon
      164
    4. 4
      neufuse
      142
    5. 5
      +FloatingFatMan
      107
  • Tell a friend

    Love Neowin? Tell a friend!