Vista/Windows7 UAC

In Vista and Windows 7, at least by default, even administrator does not have administrative privileges all the time. If something administrative needs to be done, user must explicitly put on his admin's hat and launch an "elevated" process, which will then have administrative privileges.

If a program needs to perform an administrative action on Vista/W7, it must contain a special XML resource called manifest, to indicate that the program must be "elevated" before execution.

This manifest may (and will be) embedded when XSharper script is compiled with //requireAdmin parameter. Then, when the script is executed, Vista/Windows7 will produce an elevation screen.

Alternatively, the option may be specified in the script itself:

<xsharper id="admin-tool" requireAdmin="admin">

Either way, if this script is executed under Vista/Windows7, it will produce:

UAC Screenshot1

As you see, it's possible to see from this screen which script has requested the privilege. If access is granted, XSharper reuses the original console instead of spawning the new one, thus not breaking batch files which rely on user output:

What's interesting is that in interactive mode, where script is not compiled, there are two xsharper processes running in this scenario: one w/o administrative rights, that spawned a new elevated one, which talks back to the original process via .NET remoting.