Re: Vista UAC problem with WScript.Shell Run method
- From: <m.piceni@xxxxxxxxxxxxxxxx>
- Date: Wed, 10 Jan 2007 17:34:25 +0100
Hi Luke,
sorry for late reply.
Yes, your suggestion make a lot of sense...
This is very similar to what I was trying, but I was invoking the wrong
verb. If I invoke the "runas" verb, even from a VBS, without writing a
special application, it works fine. My mistake was invoking the "RunAs
Administrator" verb (this is the verb returned by the Verbs collection of a
shell item), but this is just the "cosmetic" version of the verb, not the
actual one. In this Vista is very different from XP. In XP you need to
invoke verbs exactly as you get from the Verbs collection, while in Vista
not.
A simple VBS script that run a BAT with elevation is the following:
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\")
Set objFolderItem = objFolder.ParseName("mybat.bat")
objFolderItem.InvokeVerb "runas"
This will bring up the UAC elevation confirmation box and (if allowed) run
mybat.bat in elevated privilege mode.
This means that, if mybat.bat runs several programs that require elevation,
you'll get the confirmation box only once instead of many if you simply run
the mybat.bat alone.
Hope this may help other people.
Thanks a lot.
Massimo.
"Luke Zhang [MSFT]" <lukezhan@xxxxxxxxxxxxxxxxxxxx> ha scritto nel messaggio
news:LwY77fJNHHA.2300@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
Did my previous reply make sense on this issue? If you need more
information on this issue, please feel free to let us know.
Sincerely,
Luke Zhang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
.
- Follow-Ups:
- Re: Vista UAC problem with WScript.Shell Run method
- From: Luke Zhang [MSFT]
- Re: Vista UAC problem with WScript.Shell Run method
- References:
- Vista UAC problem with WScript.Shell Run method
- From: m.piceni
- RE: Vista UAC problem with WScript.Shell Run method
- From: Luke Zhang [MSFT]
- Re: Vista UAC problem with WScript.Shell Run method
- From: m.piceni
- Re: Vista UAC problem with WScript.Shell Run method
- From: Luke Zhang [MSFT]
- Vista UAC problem with WScript.Shell Run method
- Prev by Date: Re: Vista UAC problem with WScript.Shell Run method
- Next by Date: Problem running script using Vista
- Previous by thread: Re: Vista UAC problem with WScript.Shell Run method
- Next by thread: Re: Vista UAC problem with WScript.Shell Run method
- Index(es):
Relevant Pages
|