0

So I'm working in Visual Studio 2019 and I'm writing a .NET Core, Visual Basic, and console application, but I'm trying to figure out how to check if my program was ran as an admin/administrator? Here's my code so far:

Console.Title = "Useless Command Prompt"
FileSystem.ChDir("C:\Windows\System32")

Console.WriteLine("Microsoft Windows [Version 10.0.18362.778]")
Console.WriteLine("(c) 2019 Microsoft Corporation. All rights reserved.")
Console.WriteLine()
Console.Write("C:\WINDOWS\system32>")
Dim TypedInResponse As String = Console.ReadLine()

What I'm trying to do is change the (Console.Title = "") to an if statement on if the program was ran as an administrator. So I would write:

If PROGRAMRANASADMIN Then

    Console.Title = "Administrator: Useless Command Prompt"

Else

    Console.Title = "Useless Command Prompt"

EndIf
Joe Sewell
  • 6,067
  • 1
  • 21
  • 34

1 Answers1

0

UACHelper worked great, so this question is solved!