This issue is that certain tasks require administrator privilege on
Windows and it's much more friendly to check the current user's
privileges and inform the user that he or she needs to elevate to
admin than simply fall over. :)

Sadly before Windows 7 most users are on their machine as admins by
default (which is, truly, a large part of the reason that Windows was
such a fruitful hunting ground for people who liked to spread
trojans).  A lot of users still have admin privileges by default but a
few are smart enough to practice least-privilege.

--
Onorio

On Tue, Oct 25, 2016 at 4:35 PM, Alexander Ilin <ajs...@yandex.ru> wrote:
>
> 25.10.2016, 23:13, "Doug Coleman" <doug.cole...@gmail.com>:
>
> You should be able to call the Windows APIs directly (if you can figure out
> which ones!) and avoid using a script to call a binary.
>
>
> That's true. I'm simply having fun with that little task. Parsing the output
> and such.
> If I needed to solve that problem in a proper way, I would not mess with the
> whoami.exe, I'd look for WinAPI functions.
> I'm not familiar with those, so can't really help here.
>
> I have an issue with the formulation of the task, though. Why do we need to
> know if a user is an admin? Do we strictly want to check the Administrators
> group membership, or do we want to test for some specific access privileges?
> For instance, Power Users used to have some pretty big rights in their day,
> without being full admins.
> There is also the issue with elevation, which gives a user some rights
> without making him/her an admin.
>
> http://stackoverflow.com/questions/581204/how-do-i-check-if-a-user-has-local-admin-privileges-in-win32
> http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights/8196291#8196291
> https://support.microsoft.com/en-us/kb/118626
>
> ---=====---
> Александр
>
>
> ------------------------------------------------------------------------------
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>



-- 
Onorio Catenacci

http://onor.io
http://www.google.com/+OnorioCatenacci

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to