First, a bit of background on why I need help with this:
I added the ability to eject removable disks to my Disks Meter a few months ago. However, the current program I use, RemoveDrive, does not support USB card readers properly (it will eject the reader instead of the card within the reader). I searched far and wide and came across Sync, a program that can eject the card itself rather than the reader. The caveat? Sync requires admin privileges to work.
I need to be able to disable and hide the eject buttons if the user is not an administrator, which leads me to this problem: How do I get the account type? My first thought was in the registry, but I could not find a key in there to simply tell me what account type the current user is. My second thought was the SysInfo plugin, but that doesn't have this option either. As a last resort I looked for a CMD command to do this job, but all of the results were either "how to change your account type" or the CMD command includes a bunch of other info that I do not need.
Does anybody here have a solution to this?
(I hope I'm not just terrible at using Google...)
It is currently April 27th, 2024, 12:54 am
CMD Command / Plugin that can give me the current user type?
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
-
- Developer
- Posts: 2686
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: CMD Command / Plugin that can give me the current user type?
There is no built-in Rainmeter function (like SysInfo) that retrieves this information. I do not think you can even retrieve this via the registry either.
You may want to do run the program with "admin rights". It may prompt the UAC warning.
Check out the "elevate" command from nircmd: https://nircmd.nirsoft.net/elevate.html
Hopefully that helps.
-Brian
You may want to do run the program with "admin rights". It may prompt the UAC warning.
Check out the "elevate" command from nircmd: https://nircmd.nirsoft.net/elevate.html
Hopefully that helps.
-Brian
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
Re: CMD Command / Plugin that can give me the current user type?
Thanks for the help Brian.
For anybody interested, I did manage to find a roundabout solution to this problem. See the measures below:
For anybody interested, I did manage to find a roundabout solution to this problem. See the measures below:
Code: Select all
[MeasureUserName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=USER_NAME
IfCondition=1
IfTrueAction=[!CommandMeasure MeasureGetLocalGroup "Run"]
[MeasureGetLocalGroup]
Measure=Plugin
Plugin=RunCommand
Parameter=net localgroup Administrators
OutputType=ANSI
FinishAction=[!EnableMeasure MeasureUserAdmin][!UpdateMeasure MeasureUserAdmin]
[MeasureUserAdmin]
Measure=String
String=[MeasureGetLocalGroup]
IfMatch=(?s).*[MeasureUserName:EscapeRegExp].*
IfMatchAction=[!Log "Admin!"]
IfNotMatchAction=[!Log "Not an admin!"]
DynamicVariables=1
Disabled=1