What is the proper WMI query to display a user's account type using BGInfo?

0

I want to display a user's account type (usually standard or administrator) on the desktop using Sysinternals' BGinfo.

I believe employing a WMI query to show the accounttype "value" (Class Property?) is a possible approach but I cannot figure out a working WMI query.

WMI Query Selection

user428697

Posted 2017-10-08T19:15:37.787

Reputation: 35

Is the VBS option in BGInfo viable for what you need? E.g. https://pastebin.com/KW2FWWi4 AccountType (msdn.microsoft.com/library/aa394507(v=vs.85).aspx) isn't what you want.

– HelpingHand – 2017-10-08T21:35:34.303

Win32_UserAccount.AccountType does not indicate whether the user is an administrator. – Patrick Seymour – 2017-10-08T22:43:57.970

Thank you @HelpingHand for the script. It works perfectly! How can I give you credit here? – user428697 – 2017-10-09T03:31:12.413

@user428697, I've added my comment as an answer as it proved helpful. Thanks – HelpingHand – 2017-10-09T12:43:35.093

Answers

0

Perhaps not quite the answer you were after but as BGInfo also supports VBScript. If that is an option for you then the following script may be helpful:

dim strUser  : strUser = CreateObject("Wscript.Network").UserName
dim blnFound : blnFound = false

for each objUser in GetObject("WinNT://./Administrators").Members
    if objUser.Name = strUser then
        Echo strUser & " is a member of local administrators."
        blnFound = true
    end If
next

if blnFound = false then
  Echo strUser & " is not a member of local administrators"
end if

HelpingHand

Posted 2017-10-08T19:15:37.787

Reputation: 1 435