[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-domain/home/netlogon/domscripts/ -> execute-elevated.js (summary)

(no description)

File Size: 146 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  showUsage()
  main()
  hex()

Functions
Functions that are not part of a class:

showUsage()   X-Ref
GENERAL
=======
Author : Rainer Meier <skybeam (at) users.sourceforge.net>
Version: 1.0
License: GPLv2

DESCRIPTION
===========
This script allows execution of another script (given by parameter) in
elevated privileges mode on Windows Vista with UAC activated.

This is required as there seems to be no possibility to run a batch/cmd
script on Windows Vista with elevated rights. Even if you right-click a
cmd script and select to run it as Administrator it does not get elevated
rights.

USAGE
=====
This script here just allows you to call any script (batch, cscript ...)
with elevated rights.

NOTE: To run WPKG in elevated mode you can either write a batch file which
is calling 'cscript \\path\to\wpkg.js ...' or run cscript directly by this
script.
Running batch file:
<script> \\path\to\<batch-name.cmd> [optional arguments]
Running cscript:
<script> cscript \\path\to\wpkg.js <argument1> [argument2 [argument3 [...]]]

NOTE: Running cscript directly does not allow you to set custom environment
variables like the common SOFTWARE variable! Running this script here from a
batch script which is setting the variables will not work as the environment
of the child process which is run in elevated mode is reset to the windows
defaults.
So the following execution chain won't work (wpkg.js will not see the
exported SOFTWARE variable):
<set SOFTWARE variable> => execute-elevated.js => (elevated) wpkg.js
Only the following will work:
execute-elevated.js => (elevated) <batch to set SOFTWARE> => wpkg.js
This also works with the exisiting wrapper:
execute-elevated.js => (elevated) <batch to set SOFTWARE> => wrapper.js

Here is some sample code you can use for your own batch file. I use this one
to install all software which belongs to a specific profile to the current
machine. No matter what its name is - I always use the same profile. This is
useful for example if you need to upgrade your default bunch of software on
a customer machine.


main()   X-Ref
Main execution method. Actually runs the script


hex(nmb)   X-Ref
User-defined function to format error codes.
VBScript has a Hex() function but JScript does not.




Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1